I have a form which will be emailed to different parts of the country depending on what location the user chooses from the drop down list.
So if the user is from newcastle, he would choose newcastle from the drop down list, and click submit. The form then submits to sendApp.php and thus emails the address set in the sendApp.php
What i would like it to do is, email the address depending on what option the user has choosen.
My problem is, i dont know what if statement to use. Here is the code >>
<?php
$app_name = $_POST['app_name'];
$app_position = $_POST['app_position'];
$app_company = $_POST['app_company'];
$app_contact = $_POST['app_contact'];
$app_email = $_POST['app_email'];
$app_contactphone = $_POST['app_contactphone'];
$app_contactemail = $_POST['app_contactemail'];
$app_location = $_POST['app_location'];
$app_questions = $_POST['app_questions'];
$app_date = gmdate("Y-m-d");
//THE ADDRESS OF WHO THE FORM SUBMITS TO
$address="daz_effect@hotmail.com";
//EMAIL SUBJECT
$subject="A Customer has Submitted a Query";
//BUILD THE MESSAGE UP WITH ALL THE FORM ELEMENTS
$message = "<font size=3 face=Arial>Name:<b> ".$app_name."</b><br>";
$message .= "Position:<b> ".$app_position."</b><br>";
$message .= "Company:<b> ".$app_company."</b><br>";
$message .= "Contact Number<b> ".$app_contact."</b><br>";
$message .= "Email Address:<b> ".$app_email."</b><br>";
$message .= "Please Contact Me Via:<b> ".$app_contactphone."</b><br>";
$message .= "Please Contact Me Via:<b> ".$app_contactemail."</b><br>";
$message .= "Office Customer Would Like to Contact:<b> ".$app_location."</b><br>";
$message .= "Questions & Queries:<b> ".$app_questions."</b><br><br>";
$message .= "Date:<b> ".$app_date."</b><br></font>";
//SET THE EMAIL TYPE > DONT CHANGE
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
//THE ADDRESS THAT THE EMAIL APPEARS TO COME FROM
$headers .= "From: my Website<info@mywebsite.com>\r\n";
//SENDS THE EMAIL
$mail_send = mail($address, $subject, $message, $headers);
//IF THE EMAIL FAILS AN ERROR IS DISPLAYED
if(!$mail_send) {
header("Location: email_failure.htm");
}else{
header("Location: email_success.htm");
}
?>
At the minute the above code is just set to email to 1 person. Is this the if code i would add to make it email different people depending what option the user choose on the form?
if (!$app_location == newcastle) {
$address = [email]newcastle@mydomain.com[/email]
} else {
if (!$app_location == dewsbury) {
$address = [email]dewsbury@mydomain.com[/email]
} else {
if (!$app_location == aycliffe) {
$address = [email]aycliffe@mydomain.com[/email]
}
$mail_send = mail($address, $subject, $message, $headers);