tutwelve Posted February 4, 2007 Share Posted February 4, 2007 Hi all, PHP newbie here...couldn't find anything on this forum to help me with my issue. Hopefully, I can get some help from the friendly people here.. My Issue: I have a PHP form that when the user presses the submit button, needs to be e-mailed to possibly 4 different e-mail address based on the selections the user makes on the form. For example, on my form, I have a drop down menu containing four choices. If a user chooses choice #1 from the menu, it needs to be sent to a certain e-mail address. But If the user chooses choice #2 from the menu, it needs to be sent to another e-mail address...etc... Can anyone point me to a tutorial or give me advice how I can construct the conditional statements to ensure that the completed form will go to the correct e-mail address based on the choices the user makes? All help is greatly appreciated. Thanks! TuTwelve Link to comment https://forums.phpfreaks.com/topic/37007-php-mail/ Share on other sites More sharing options...
PC Nerd Posted February 4, 2007 Share Posted February 4, 2007 ok, first and formostly look at the mail function secondly all youd need would be to change a variable depending on the selection eg if($op1 == 'true'){$email = "EMAIL1";} repeat this for all options then mail($email, $body, $anythingiveforgottentomention) good luck Link to comment https://forums.phpfreaks.com/topic/37007-php-mail/#findComment-176669 Share on other sites More sharing options...
tutwelve Posted February 4, 2007 Author Share Posted February 4, 2007 Thanks for the quick response, PC Nerd... So for the following code, what would the processing code look like? <form id="form_1" name="form_1" method="post" action="process.php"> <label> <select name="select"> <option value="one">Choice 1</option> <option value="two">Choice 2</option> <option value="three">Choice 3</option> <option value="four">Choice 4</option> </select> </label> <label> <input name="submit" type="submit" id="submit" value="send" /> </label> </form> I'm not sure how to make a variable out of what the user chooses... Thanks again for all of your help! TuTwelve Link to comment https://forums.phpfreaks.com/topic/37007-php-mail/#findComment-176826 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.