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!

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.