Page 1 of 1

Newbie to PHP needs help with email form?

Posted: Tue Feb 17, 2004 12:33 pm
by Lou Ghaddar
I am new to PHP, but I have got an email form to work but I think I am haveing trouble passing variables correctly. I have a Flash web site that has a form on it. The form has 7 fields that I am trying to submit via email. So far it is working but the only field that is sending is FirstName. The fields that I have are as follows:
firstName, lastName, phone, altPhone, email, address, and commentBox.

My codes is as follows:
<?php
$sendTo = "lou@selway.umt.edu";
$subject = "Design Turf Career Oppurtunities Reply";
$headers = "From: " . $_POST["firstName"] ;
$headers .= "<" . $_POST["email"] .">\r\n";
$message = "First Name: " . $_POST["firstName"];

mail($sendTo, $subject, $message, $headers);
?>

Posted: Tue Feb 17, 2004 1:20 pm
by ol4pr0
Might be easyer to do some with this if you post the form code aswell ;-)

Code: Select all

// this looks so much better 
//

Code: Select all

youre code
<?php
$sendTo = "lou@selway.umt.edu";
$subject = "Design Turf Career Oppurtunities Reply";
$headers = "From: " . $_POST["firstName"] ;
$headers .= "<" . $_POST["email"] .">\r\n";
$message = "First Name: " . $_POST["firstName"];

mail($sendTo, $subject, $message, $headers);
?>


Posted: Tue Feb 17, 2004 1:27 pm
by Lou Ghaddar
The form is built in Flash so it is a little hard to post the code. I have seven fields and each field has a variable name like the ones I posted.

the variables are as follows:
firstName, lastName, phone, altPhone, email, address, and commentBox.

They are all input fields in a Flash movie clip. The firstName field is working, I just can't figure out how to "POST" more than one field. Any ideas. Can I just add another line somehow for each field. I have tried to add more $message commands, but when I do, nothing works. How do I go about getting all the fields to POST?

Posted: Tue Feb 17, 2004 1:30 pm
by ol4pr0

Code: Select all

" . $_POST["firstName"] " ', ' " . $_POST["otherfield"] " ',' "  ect

Code: Select all

/* slight mistake that should be.. */
" '. $_POST["firstName"] . " ', ' " . $_POST["otherfield"] . " ',' "  ect

Posted: Tue Feb 17, 2004 1:33 pm
by Lou Ghaddar
OK, I will give that a try and let you know how it turns out.

Thanks. :wink:

Posted: Tue Feb 17, 2004 8:58 pm
by Lou Ghaddar
OK that worked great! Thanks for the tip. How would I go about making every field appear on the next line. Like this:

Field1
Filed2
Field 3
Field 4
etc...
Is there a paragraph break syntax or something?