cesjds Posted June 11, 2010 Share Posted June 11, 2010 I am a novice at web design but I'm working on creating a simple email form using php. It's going OK but I cannot get the form to send me (via email) anything other than the first item I put in the else section. How do I get my other variables (last_name, email_address, etc..) to show up in the email? I'm sure this is very simple and I've tried several things, none of them working. I've checked to make sure I'm using the same name and I am. else { mail( "$webmaster_email", "Feedback Form Results", $first_name, "From: $email_address" ); header( "Location: $thankyou_page" ); } ?> With the above code, the first name will show up in the email I get from the form. How do I add all the form variables to my email? Thank you so much! Link to comment https://forums.phpfreaks.com/topic/204491-php-email-form-should-be-simple-but-im-stuck/ Share on other sites More sharing options...
TOA Posted June 11, 2010 Share Posted June 11, 2010 How do I add all the form variables to my email? http://php.net/manual/en/function.mail.php Put everything you want into a $body variable, here's an example that I use all the time $to = [email protected]; $subject = 'Your temporary password'; $body = 'Your temporary password is:'.$password; $hdrs = 'From: Whoever'; mail($to, $subject, $body, $hdrs); and to add more headers $hdrs = 'From: Whoever'; $hdrs .= 'Reply to: [email protected]'; Hope that helps Link to comment https://forums.phpfreaks.com/topic/204491-php-email-form-should-be-simple-but-im-stuck/#findComment-1070806 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.