PDA

View Full Version : e-mail a confirmation of form sent...how?


SmoothCanvas
10-18-2007, 09:55 PM
Where do I go? What do I need? I've built working forms using dreamweaver and PHP. The code of one of them is here:

<?PHP


$req = '1';
$to = "dhuang@spicenet.net";
$subject = "Levinson website Strategic Organization Registration Form submission";
$message .= " Prefix: " . $_POST['prefix'];
$message .= "\n First Name: " . $_POST['firstName'];
$message .= "\n MI: " . $_POST['mi'];
$message .= "\n Last Name: " . $_POST['lastName'];
$message .= "\n\n Title: " . $_POST['title'];
$message .= "\n Company: " . $_POST['company'];
$message .= "\n\n Address: " . $_POST['address'];
$message .= "\n City: " . $_POST['city'];
$message .= "\n Zip: " . $_POST['zip'];
$message .= "\n Country: " . $_POST['country'];
$message .= "\n\n Phone: " . $_POST['phone'];
$message .= "\nCell Phone: " . $_POST['cellphone'];
$message .= "\n Fax: " . $_POST['fax'];
$message .= "\n E-mail: " . $_POST['Email'];
$message .= "\n\nDescription of Organization: " . $_POST['organization'];
$message .= "\n\nSeminar you wish to attend: " . $_POST['seminarDate'];
$message .= "\n\nBilling information\n Name: " . $_POST['billName'];
$message .= "\n Title: " . $_POST['billTitle'];
$message .= "\nAddress: " . $_POST['billAddress'];
$message .= "\n Phone: " . $_POST['billPhone'];
$message .= "\n Email: " . $_POST['billEmail'];

$headers = "From:". $_POST['Email'];
$headers .= "\nReply-To:".$_POST['Email'];

foreach ($_POST as $key => $value)
{
if ($req == '1')
{
if ($value == '')
{echo header ("Location:error.html");die;}
}
$j = strlen($key);
if ($j >= 2000)
{echo "Name of form element $key cannot be longer than 2000 characters";die;}
$j = 2000 - $j;
for ($i = 1; $i <= $j; $i++)
{$space .= ' ';}
$value = str_replace('\n', "$line", $value);
$conc = "{$key}:$space{$value}$line";
$text .= $conc;
$space = ' ';
}

$sentOk = mail($to,$subject,$message,$headers);
if($sentOk){
echo header ("Location:thankyou.html");
}else{
echo "sentError=" . $sentError;
}

?>

davidj
10-19-2007, 06:36 AM
did you cut and paste this from somewhere or did you write it your self