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! Quote Link to comment 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 = whoever@email.com; $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: Me@email.com'; Hope that helps Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.