Jump to content

Mail Form Drop Down to Different People


signature16

Recommended Posts

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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.