View Single Post
Old 02-16-2006, 08:26 PM   #3 (permalink)
hygor
 
Ultra Techie

Join Date: Feb 2004

Posts: 833

hygor

Default

Here is a simplified version of the way I process my php mail forms (though i have not included any error checking or field handling here ... just the send stuff)


// I set the static features (where its going and its subject

$to = 'emailaddress@theinternet.com';
$subject = 'Mail form query';

//Then I populate the from address and email body from my mail form

$body = "Comment/Query:" . $_POST['CommText'];
$from = "From: " . $_POST['EmailTxt'];

//then i send

mail ($to, $subject, $body, $from);


// and redirect to a confirmation page (where my pages are controlled by variables in the query string)

header("Location: ?hs=9");

//this could easily be "Location: thanks.php" or similar

-----

if you have more than one item you want to include in the message copy i.e. phone number, first name etc...

simply build the $body variable as follows

$body = "Name: " . $_POST['NameTxt'] . " ";
$body = $body . "PhoneNo: " . $_POST['PhoneTxt'] . " ";
$body = $body . "Comment/Query:" . $_POST['CommText'] . " ";

Hope this is of some help to you!
__________________
hygor is offline