I have created a form and want it emailed to me upon submission. I have tried it in a file that contains form and php for email and it works but sends 2 copies of the email, first one blank 2nd is proper.
I aslo broke it into 2 php files, one with form, other to format and send email. This one doesn't do anything. It does pass the contents of the field but does not send the email.
Here is the code set up for the 1st scenerio, I have only included the php code if anyone needs to see the rest which is just the form let me know.
<?
function checkOK($field)
{
if (eregi("\r",$field) || eregi("\n", $field)){
die ("Invaild Input");
}
}
$name=$_POST['name'];
checkOK($name);
$company=$_POST['company'];
checkOK($company);
$address=$_POST['address'];
checkOK($address);
$postal=$_POST['postal'];
checkOK($postal);
$telephone=$_POST['telephone'];
checkOK($telephone);
$fax=$_POST['fax'];
checkOK($fax);
$poo=$_POST['poo'];
checkOK($poo);
$destination=$_POST['destination'];
checkOK($destination);
$truckload=$_POST['truckload'];
checkOK($truckload);
$ltl=$_POST['ltl'];
checkOK($ltl);
$hazard=$_POST['hazard'];
checkOK($hazard);
$assisted=$_POST['assisted'];
checkOK($assisted);
$pallet=$_POST['pallet'];
checkOK($pallet);
$weight=$_POST['weight'];
checkOK($weight);
$description=$_POST['description'];
checkOK($description);
$equipment=$_POST['equipment'];
checkOK($equipment);
$comments=$_POST['comments'];
checkOK($comments);
$to="brent@atlanticautos.ca";
$message="$name has submitted a rate request.\n\n Details are listed below:
<b>Name:</b> $name
<b>Company:</b> $company
<b>Address:</b> $address
<b>Postal/Zip:</b> $postal
<b>Email:</b> $email
<b>Tel:</b> $telephone
<b>Fax:</b> $fax
<b>Origin:</b> $poo
<b>Destination:</b> $destination
<b>Truckload:</b> $truckload
<b>LTL:</b> $ltl
<b>Hazardous:</b> $hazard
<b>Driver Asst:</b> $assisted
<b>Palletized:</b> $pallet
<b>Weight:</b> $weight
<b>Description:</b> $description
<b>Equipment:</b> $equipment
<b>Comments:</b> $comments";
if(mail($to,"Rate Request",$message,"From: $email\n")){
echo "thanks!";
}else{
echo "there was a problem";
}
?>
any help, suggestions, hints would be really appriceated. If anyone needs more info on this let me know.
tia
|