PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Lets say I have 5 different options in my combo box (5 different languages)
English
German
Polish
Italian
Russian
when one choses English, I want the email to be sent to english@english.com
when one choses German, I want the email to be sent to german@german.com
etc
different otion chosen, different email address that the form is sent to. How to do that?
[syntax="html"]<td width=\"60%\"><select size=\"1\" name=\"language\">
<option>English</option>
<option>German</option>
<option>Polish</option>
<option>Italian</option>
<option>Russian</option>
<option selected>Choose...</option>
</select></td>
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
The other thing you will want to do is validate the input and use it to build your email address to send to.
To validate (which you should always do for security reasons) create an array of acceptable values and test (in_array() is good) that the input is one of them, blow the user out if it isn't. This is called white-listing.
Once you are sure the variable is a known and safe value use it to construct the email address using the concatenation operator (.).
For actually sending the email you can use mail() or, better, SwiftMailer library.