Click to See Complete Forum and Search --> : Drop down menu in simple contact form?


seowitz
08-13-2003, 11:45 AM
Hi, I haven't used forms much so this should be an easy question to answer.

In using a simple php form processing script, I'd like the recipient in the form to be selected via a drop down menu.

Could anyone help me with this?
I've tried a few times but it just never seems to work right for me.

pyro
08-13-2003, 11:58 AM
Use something like this:

mail ($_POST["selectname"],"subject","message","headers");Where selectname is the name of the select box in your form. This also assumes you are using the POST method.

seowitz
08-13-2003, 12:04 PM
any chance you could point me to a full-working page example with it's form processor too?

pyro
08-13-2003, 12:33 PM
Something like this:

<?PHP
if (isset($_POST["submit"])) {
mail($_POST["myselect"],"subject","message");
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<form action="<?PHP echo $_SERVER["PHP_SELF"]; ?>" method="post">
<p><select name="myselect">
<option value="your@your.com">EmailOne</option>
<option value="someoneelse@your.com">EmailTwo</option>
</select>
<input type="submit" name="submit"></p>
</form>
</body>
</html>And you could easily incorperate that into this (http://www.webdevfaqs.com/php.php#mailer) form handler.