306 TD Slut
I use a basic php contact form in most of my websites, which collects the data entered into several form fields and then sends it to a single email address.
I have been looking for a contact form where the user can select which receipient the data goes too.
So a drop down box with 3 names in so the user can select who to contact.
Does anyone have an php for this? or can i adapt the one i use already
Dont want anything too complex im sure there is a simple bit of code i can add?
thanks in advance,
I have been looking for a contact form where the user can select which receipient the data goes too.
So a drop down box with 3 names in so the user can select who to contact.
Does anyone have an php for this? or can i adapt the one i use already
Code:
<?php
// Website Contact Form Generator
// [URL]http://www.tele-pro.co.uk/scripts/contact_form/[/URL]
// This script is free to use as long as you
// retain the credit link
// get posted data into local variables
$EmailFrom = Trim(stripslashes($_POST['EmailFrom']));
$EmailTo = "[EMAIL="mark.simons@yahoo.co.uk"]mark.simons@yahoo.co.uk[/EMAIL]";
$Subject = "MESSAGE FROM SAM WEBSITE";
$Name = Trim(stripslashes($_POST['Name']));
$Telephone = Trim(stripslashes($_POST['Telephone']));
$MessageSubject = Trim(stripslashes($_POST['MessageSubject']));
$Enquiry = Trim(stripslashes($_POST['Enquiry']));
// validation
$validationOK=true;
if (Trim($EmailFrom)=="") $validationOK=false;
if (empty($Name)) $validationOK=false;
if (empty($Telephone)) $validationOK=false;
if (empty($MessageSubject)) $validationOK=false;
if (empty($Enquiry)) $validationOK=false;
if (!$validationOK) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.html\">";
exit;
}
// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "Telephone: ";
$Body .= $Telephone;
$Body .= "\n";
$Body .= "Regarding: ";
$Body .= $MessageSubject;
$Body .= "\n";
$Body .= "Enquiry: ";
$Body .= $Enquiry;
$Body .= "\n";
// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=ok.html\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.html\">";
}
?>
Dont want anything too complex im sure there is a simple bit of code i can add?
thanks in advance,