Jump to content

PHP email form - should be simple but I'm stuck!


cesjds

Recommended Posts

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!

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.