Forum Moderators: coopster
I understand how to do a simple feedback script, and I understand how to create the menu, I'm just not sure how to tie the together.
Would anyone give me a hand on this?
<select name="email">
<option value="">select a dept</option>
<option value="1">sales</option>
<option value="2">marketing</option>
<option value="3">human resources</option>
</select>
You can access this in the script that the form posts to by accessing the $_POST [ca.php.net] superglobal array. First test to make sure a selection was made.
if ($_POST['email'] == "" ¦¦!isset($_POST['email'])) {
echo "you didn't pick a dept";
} else {
switch ($_POST['email']) {
case 1:
$mail_to = "sales@example.com";
break;
case 2:
$mail_to = "marketing@example.com";
break;
case 3:
$mail_to = "hr@example.com";
break;
}
// then you can do your mail call here
$sub = "some subject";
$mess = "Message stuff";
$mailhead = "your preferred mail headers here";
mail($mail_to,$sub,$mess,$mailhead);
} note: code in posts have the ¦ changed to a broken pipe char. Always replace pipes in pasted code