Jump to content

Recommended Posts

Posted

I got this PHP code off a site and its works great. But I added a new field called 'name' and I cant find out a way to include that field when the results are emailed to me. Right now, the only thing I get in the message field of my email is the $message. I tried adding, $message,$name but then I get an error and the email does note even get sent.

 

What I want is for the email I get to include the $message and the $name fields. Right now it just includes the $message field

  $email = $_REQUEST['email'] ;
 $message = $_REQUEST['message'] ;
 $name = $_REQUEST['name'];

 mail( "[email protected]", "Form Results",
   $message, "From: $email" );
 header( "Location: thankyou.html" );
?>

Posted

Hi Jim,

 

This should suffice.

 

Kim.

 

 $email = $_REQUEST['email'] ;
 $message = $_REQUEST['message'] ;
 $name = $_REQUEST['name'];

 mail( "[email protected]", "Form Results",
   "Name: $name\nMessage: $message", "From: $email" );
 header( "Location: thankyou.html" );
?>

  • Thanks 1
Posted

  $email = $_REQUEST['email'] ;
 $message = $_REQUEST['message'] ;
 $name = $_REQUEST['name'];

 mail( "[email protected]", "Form Results",
   $message, "From: $name <$email>" );
 header( "Location: thankyou.html" );
?>

 

 

Other vague improvement:

 

 if( mail( "[email protected]", "Form Results",   $message, "From: $name <$email>" ))
 {
   header( "Location: thankyou.html" );
 } else {
   header("Location: sorrycouldntbedone.html");
 }

  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...