But I wouldn't have those emails as drop downs in your form as far as values go.
I would do it a little like this.
- Code: Select all
..other form stuff ehre...
<select name="tofield">
<option value="1">Contact Request</option>
<option value="2">Price Check on Isle 3</option>
<option value="3">Can I speak to a Manager</option>
</select>
</form>
And then on your mailing side..
- Code: Select all
$array = array('1'=>'contact@mydomain.com',
'2'=>'pricecheck@mydomain.com',
'3'=>'manager@mydomain.com');
if (isset($_POST['tofield'])) {
$to = $_POST['tofield'];
} else {
$to = 'default';
}
switch ($to) {
case 1:
$subject = "Contact Request Information";
$mailto = $array['1'];
break;
case 2:
$subject = "Price Check on Isle 3";
$mailto = $array['2'];
break;
case 3:
$subject = "I need to speak to your Manager";
$mailto = $array['3'];
break;
default:
$subject = "Customer didn't pick an option, so this is the catch all.";
$mailto = "mydefaultmailbox@mydomain.com";
break;
}
switch is WAY faster than IF.
having an array stuffed on the backside prevents HTML EMAIL scrubbing.
Having a catch all will help catch the customer that doesn't understand left mouse click.
Good luck.