Newbie to PHP needs help with email form?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Lou Ghaddar
Forum Newbie
Posts: 9
Joined: Tue Feb 17, 2004 12:33 pm

Newbie to PHP needs help with email form?

Post 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);
?>
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post 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);
?>

Lou Ghaddar
Forum Newbie
Posts: 9
Joined: Tue Feb 17, 2004 12:33 pm

Post 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?
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

Code: Select all

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

Code: Select all

/* slight mistake that should be.. */
" '. $_POST["firstName"] . " ', ' " . $_POST["otherfield"] . " ',' "  ect
Last edited by ol4pr0 on Tue Feb 17, 2004 2:41 pm, edited 5 times in total.
Lou Ghaddar
Forum Newbie
Posts: 9
Joined: Tue Feb 17, 2004 12:33 pm

Post by Lou Ghaddar »

OK, I will give that a try and let you know how it turns out.

Thanks. :wink:
Lou Ghaddar
Forum Newbie
Posts: 9
Joined: Tue Feb 17, 2004 12:33 pm

Post 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?
Post Reply