PDA

View Full Version : HELP simple contact form


javierrebelde
08-13-2009, 03:01 AM
Hi,
I am trying to do this but i am new. this is what i am trying to do
i got first name, last name, pick up = (mm1) month, (dd1) day, (yyyy1) year drop off = (mm2) month, (dd2) day, (yyyy2) year
what i want is send this like this

From: fname lname
pick up Day: 2/15/2009
drop off Day: 2/20/2009


<?php
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$mm1 = $_POST['mm1'];
$dd1 = $_POST['dd1'];
$yyyy1 = $_POST['yyyy1'];
$mm2 = $_POST['m2'];
$dd2 = $_POST['dd2'];
$yyyy2 = $_POST['yyyy2'];

mail("myemail@hotmail.com",$message,"From: ".$fname." ".$lname."");

?>

edbr
08-13-2009, 03:10 AM
$message =
" pick up Day: $mm1/ $dd1/$yyyy1 \n
drop off Day: $mm2/ $dd2/$yyyy2";

javierrebelde
08-13-2009, 04:44 AM
Nop, I Try It But I Dont Now What I Am Doing Wrong.

edbr
08-13-2009, 05:01 AM
what is happening? what are you getting

javierrebelde
08-13-2009, 05:06 AM
Parse error: syntax error, unexpected ';' on line 15

<?php
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$mm1 = $_POST['mm1'];
$dd1 = $_POST['dd1'];
$yyyy1 = $_POST['yyyy1'];
$mm2 = $_POST['m2'];
$dd2 = $_POST['dd2'];
$yyyy2 = $_POST['yyyy2'];

mail("myemail@hotmail.com",$message =
" pick up Day: $mm1/ $dd1/$yyyy1 \n
drop off Day: $mm2/ $dd2/$yyyy2";

?>

edbr
08-13-2009, 05:19 AM
no try this
<?php

$fname = $_POST['fname'];
$lname = $_POST['lname'];
$mm1 = $_POST['mm1'];
$dd1 = $_POST['dd1'];
$yyyy1 = $_POST['yyyy1'];
$mm2 = $_POST['m2'];
$dd2 = $_POST['dd2'];
$yyyy2 = $_POST['yyyy2'];
$email="myemail@hotmail.com";
$from = "From:$fname $lname\r\n";
$subject="Form Information":
$message =
" pick up Day: $mm1/ $dd1/$yyyy1 \r\n
drop off Day: $mm2/ $dd2/$yyyy2 \r\n
From:$fname $lname";

mail($email,$subject,$message);

?>

javierrebelde
08-13-2009, 05:31 AM
Finally i fond 2 error but i fix it some miss spelling but finally thanks i need this simple form to use this example to create one with more things and then learn how to send that but as a html with images and table but for now is all i need a basic example thanks

edbr
08-13-2009, 05:40 AM
ok good, you need some validation on this

javierrebelde
08-14-2009, 02:37 AM
Hi, AGAIN.

i follow the yesterday instruction vut i dont know why i receive the email but without the info example:

this is what i want
first name: myname

this is wht i get
first name:

help

<?php
$firstname = $_POST['element_1_1'];
$lastname = $_POST['element_1_2'];
$streetAddress = $_POST['element_2_1'];
$Address2 = $_POST['element_2_2'];
$city = $_POST['element_2_3'];
$state = $_POST['element_2_4'];
$zipcode = $_POST['element_2_5'];
$country = $_POST['element_2_6'];
$areacode = $_POST['element_3_1'];
$prefix = $_POST['element_3_2'];
$number = $_POST['element_3_3'];
$email = $_POST['element_4'];
$car = $_POST['element_9'];

$pickplace = $_POST['element_10'];
$pickpOther = $_POST['element_5'];
$pickpmomth = $_POST['element_7_1'];
$PickpDate = $_POST['element_7_2'];
$Pickpyear = $_POST['element_7_3'];

$droppPlace = $_POST['element_11'];
$dropother = $_POST['element_6'];
$dropmomth = $_POST['element_8_1'];
$dropdate = $_POST['element_8_2'];
$dropyear = $_POST['element_8_3'];

$to="myemail@hotmail.com";
$from = "From:element_1_1 element_1_2";
$subject="Reservation";

$message =
"First name: $element_1_1
Last Name: $element_1_2
Street Address: $element_2_1
Address2: $element_2_2
City: $element_2_3
State/Providence/Region: $element_2_4
Zip Code: $element_2_5
Country: $element_2_6
Telephone: ($element_3_1) $element_3_2-$element_3_3
Email: $element_4
Car: $element_9

pick Up Place: $element_10
pick Up Other: $element_5
Pick Up Date: $element_7_1/$element_7_2/$element_7_3

Drop Off Place: $element_11
Drop Of Other: $element_6
Drop Of Date: $element_8_1/$element_8_2/$element_8_3";

mail($to,$subject,$message);

?>

edbr
08-14-2009, 03:09 AM
you have coded $element_1_1(for example)
by which you mean i suppose $_POST['element_1_1']

you have define this as $firstname = $_POST['element_1_1']; so if you use
$firstname you should get it. same is true for other incorrect values.
the values are being passed to your script as $_POST values you could use these or re assign new names as the above examples

javierrebelde
08-14-2009, 03:29 AM
Yea you are right, and i'm telling you i check your example like 10 time and i didnt see that but yea you are right. that is my first notated

thanks.