Page 1 of 1

Mail Form

Posted: Wed Jan 17, 2007 7:10 pm
by ChrisInTn
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


I've looked everywhere and tried everything and I'm stumped. Can somebody please help me by letting me know the proper format to send the contents of the form fields below via email? The form is working correctly, but I don't know how to send the contents of each form field I've defined. This is the part of the code below that begins with "mail". As it is now, it's sending on the contents of the "message" field, and I don't know how to add the others. I appreciate any help.

Code: Select all

<?

  $referers = array('www.website.com', 'website.com.com');
ini_set("SMTP","mail.website.com");

  $firstName = $_REQUEST['firstName'] ;
  $lastName = $_REQUEST['lastName'] ;
  $emailAddress = $_REQUEST['emailAddress'] ;
  $phoneNumber = $_REQUEST['phoneNumber'] ;
  $addressOne = $_REQUEST['addressOne'] ;
  $addressTwo = $_REQUEST['addressTwo'] ;
  $phoneNumber = $_REQUEST['phoneNumber'] ;
  $city = $_REQUEST['city'] ;
  $state = $_REQUEST['state'] ;
  $zipCode = $_REQUEST['zipCode'] ;
  $message = $_REQUEST['message'] ;

mail( "myemail@website.com", "Form Submitted on Website.com's Form",
   $message, "From: $emailAddress");

  header( "Location: http://www.website.com/confirm.php" );
  
?>

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Wed Jan 17, 2007 8:42 pm
by volka
The third parameter of mail() is the message/mail body. You're passing $message as third parameter.
Currently only $_REQUEST['message'] is assigned to $message. You can append more values to $message, see http://www.php.net/manual/en/language.o ... string.php

Posted: Thu Jan 18, 2007 6:30 am
by dibyendrah
If message should be sent in plain text, just append the text in using \n.

Code: Select all

$message = $firstName."\n".$lastName ."\n".$emailAddress."\n".$phoneNumber."\n".$addressOne."\n".$addressTwo."\n".$phoneNumber."\n".$city."\n".$state."\n".$zipCode."\n".$_REQUEST['message'] ; 

Thank you

Posted: Thu Jan 18, 2007 1:14 pm
by ChrisInTn
Thanks for the help; I appreciate it. I've solved the problem with your examples.