I want to be able to send email to two different emails address but the address which the email is sent to will depend on the location selected on the location list. At the moment I am getting emails for my first info@me.com and it only sends the the column headers as for the other email, I am not getting anything. Please could someone help.
<?php
header('Content-type: application/json');
$status = array(
'type'=>'success',
'message'=>'Thank you for contact us. As early as possible we will contact you '
);
$emals = [
$name = @trim(stripslashes($_POST['name'])),
$title = @trim(stripslashes($_POST['title'])),
$email = @trim(stripslashes($_POST['email'])),
$number = @trim(stripslashes($_POST['number'])),
$message = @trim(stripslashes($_POST['message'])),
$location = @trim(stripslashes($_POST['location']))
];
$email_from = $email;
switch ($location) {
case 'United Kingdom':
$email_to = "info@me.com";
break;
case 'Ireland':
$email_to = "email@me.com";
break;
default:
$email_to = "iinfo@me.com";
break;
}
$body = 'Title: '. $title . "\n\n" .'Name: ' . $name . "\n\n" . 'Email: ' . $email . "\n\n" . 'Number: ' . $number . "\n\n" . 'Message: ' . $message . "\n\n" . 'Location: '. $location;
$success = @mail($email_to, $number, $body, 'From: <'.$email_from.'>');
echo json_encode($status);
die;
?>
<html>
<head>
</head>
<body>
<div class="row contact-wrap">
<div class="status alert alert-success" style="display: none"></div>
<form id="main-contact-form" class="contact-form" name="contact-form" method="post" action="sendenquiry.php">
<div class="col-sm-10 col-sm-offset-1">
<br/>
<h2>Call one of our experts on</h2> <br/>
<h2> <label> <a href="tel://033 0335 1277"><span class="glyphicon glyphicon-phone-alt"></span>  033 0335 1277</a> </label> <p/></h2>
Simply complete the form below and one of our experts will get back to you.<p/>
<div class="form-group">
Location *
<select name = "location" class="form-control">
<option value="United Kingdom">United Kingdom</option>
<option value="Ireland">Ireland</option>
</select>
</div>
<div class="form-group">
Full Name*
<input name = "name" type="text" class="form-control" required="required">
</div>
Email-Address *
<div class="form-group">
<input type="email" class="form-control" required="required">
</div>
Telephone Number*
<div class="form-group">
<input type="number" class="form-control" required="required">
</div>
<div class="form-group">
<textarea name="message"= placeholder="Basic description of your enquiry" id="message" required="required" class="form-control" rows="8"></textarea>
</div>
<div class="form-group">
<button type="submit" name="submit" class="btn btn-primary btn-lg" required="required">Submit Message</button>
</div>
</div>
</form>
</div><!--/.row-->
</body>
</html>