Aha... I think I see your problem. In this code:
<form method= 'POST' action= '<?= $_SERVER['PHP_SELF'] ?>'>
<select name= 'dept'>
<option value=" ">Select a Department</option>
<option value= "<?= $support?>">Technical</option>
<option value= "<?= $sales?>">Sales</option>
<option value= "<?= $billing?>">Billing</option>
</select>
... when you first load the form, $support, $sales, and $billing all equal the same thing... nothing! So, whatever you select makes $_POST['dept'] equal nothing. Since the first condition in your if statment (if nothing equals nothing) is met, $sendto will always be blah@singnet.com.sg. Make sense?
Here's what you need to do:
Your select tag needs to be called dept[] (with the brackets). This tells PHP that it's an array (even though it will only have one value).
each option should either not have a value, or have a value equivalent to its choice (like "support" for Technical, etc.).
You need this code to extract the value of "dept" once the form is posted:
if (!empty($_POST["dept"])) {
foreach($_POST["dept"] as $value) {
$dept = $value;
}
}
Now, modify your if statement. Better yet, make it a switch statement:
switch ($dept) {
case "support":
$sendto = "blah@singnet.com.sg";
break;
case "sales":
$sendto = "blah@hotmail.com";
break;
case "billing":
$sendto = "blah@sp.edu.sg";
break;
default:
$sendto = "blah@nowhere.com";
break;
}
Let us know if that does the trick.