Hi,
My apologies if this is already posted, I've searched everywhere (google, etc) but just can't seem to get it right.
My form has a drop down in it where people may select a city ... and each city has it's own email.
For example:
If city 'Mathis' is selected, then an email will go to x@mathis.com
If city 'Orange Grove' is selected, then an email will go to x@orangegrove.com
and so on ...
Below is where I'm at with he form, but I can't get this to work.
I'd really appreciate any help with this, thank you so much ...
Code:
- <?php
- $EmailFrom = "xxx";
- $EmailTo = "xxx";
- if (Locations===Marthis) {
- mailto = "x@mathis.com";
- } else if (Locations===Orange Grove) {
- mailto = "x@og.com";
- }
- $Subject = "Customer Request";
- $locations= htmlspecialchars(Trim(stripslashes($_POST['Locations'])));
- $Name = htmlspecialchars(Trim(stripslashes($_POST['Name'])));
- $Phone = htmlspecialchars(Trim(stripslashes($_POST['Phone'])));
- $Email = htmlspecialchars(Trim(stripslashes($_POST['Email'])));
- $Message = htmlspecialchars(Trim(stripslashes($_POST['Message'])));
- // validation
- $validationOK=true;
- if (!$validationOK) {
- print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
- exit;
- }
- // prepare email body text
- $Body = "";
- $Body .= "Name: ";
- $Body .= $Name;
- $Body .= "\n";
- $Body .= "Phone: ";
- $Body .= $Phone;
- $Body .= "\n";
- $Body .= "Email: ";
- $Body .= $Email;
- $Body .= "\n";
- $Body .= "Location: ";
- $Body .= $Locations;
- $Body .= "\n";
- $Body .= "Request: ";
- $Body .= $Request;
- $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=submit.htm\">";
- }
- else{
- print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
- }
- ?>
Jennifer ~
|