signature16 Posted February 16, 2007 Share Posted February 16, 2007 I am trying to create a mail form that will allow the user to select where the email should go. For example I want a drop down menu that includes the following: >Email John Doe >Email Foo Bar >Email Foo Bar's Girlfriend If John Doe is selected I want the email to be sent to [email protected]. Can somebody point me in the right direction about how to do this? Link to comment https://forums.phpfreaks.com/topic/38826-mail-form-drop-down-to-different-people/ Share on other sites More sharing options...
superuser2 Posted February 16, 2007 Share Posted February 16, 2007 Here: <?php $user = array(); $user['John Doe'] = "[email protected]"; //List all your names and emails like this $user['Jane Doe'] = "[email protected]"; $user['Joe Doe'] = "[email protected]"; ?> <!-- Put your other form stuff here, like your opening tag and a textarea for the message --> <select name='email'> <?php foreach($user as $key => $value) { echo "<option value='$value'>$key <$value></option>"; } ?> </select> Then the value of $_POST['email'] in the receiving script is the email address to send to. Link to comment https://forums.phpfreaks.com/topic/38826-mail-form-drop-down-to-different-people/#findComment-186672 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.