mhnd Posted January 10, 2013 Share Posted January 10, 2013 Hi Guys i am struggling since morning with this silly piece of code, can anybody tell me what i am doing wrong i need my script to send the email according to value chosen on html form html code: . . <select name="sendto"> <option value="b" selected>Charlene & Natalie</option> <option value="c">Charlene Only</option> <option value="n">Natalie Only</option> </select> . . . php code if ($_REQUEST['sendto']=='b') { $MyEmail = '[email protected]'; }elseif ($_REQUEST['sendto']=='c') { $MyEmail = '[email protected]'; }elseif ($_REQUEST['sendto']=='n') { $MyEmail = '[email protected]'; } . . . . if (mail($MyEmail, $subject, $body, $headers)) { echo "success"; }else{ echo "Error : Faild to send email"; } NOTE: the form works perfectly if i assign a value to $MyEmail without the if condition any suggestions Link to comment https://forums.phpfreaks.com/topic/272948-mail-form/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.