Drop down menu in simple contact form?

liunx

Guest
Hi, I haven't used forms much so this should be an easy question to answer.<br />
<br />
In using a simple php form processing script, I'd like the recipient in the form to be selected via a drop down menu.<br />
<br />
Could anyone help me with this?<br />
I've tried a few times but it just never seems to work right for me.<!--content-->Use something like this:<br />
<br />
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.<!--content-->any chance you could point me to a full-working page example with it's form processor too?<!--content-->Something like this:<br />
<br />
<?PHP<br />
if (isset($_POST["submit"])) {<br />
mail($_POST["myselect"],"subject","message");<br />
}<br />
?><br />
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"<br />
"http://www.w3.org/TR/html4/strict.dtd"><br />
<html><br />
<head><br />
<title>Untitled Document</title><br />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><br />
</head><br />
<br />
<body><br />
<form action="<?PHP echo $_SERVER["PHP_SELF"]; ?>" method="post"><br />
<p><select name="myselect"><br />
<option value="[email protected]">EmailOne</option><br />
<option value="[email protected]">EmailTwo</option><br />
</select><br />
<input type="submit" name="submit"></p><br />
</form><br />
</body><br />
</html>And you could easily incorperate that into this (<!-- m --><a class="postlink" href="http://www.webdevfaqs.com/php.php#mailer">http://www.webdevfaqs.com/php.php#mailer</a><!-- m -->) form handler.<!--content-->
 
Back
Top