mhnd Posted January 10, 2013 Share Posted January 10, 2013 (edited) 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 = 'b@email.co.uk'; }elseif ($_REQUEST['sendto']=='c') { $MyEmail = 'c@email.co.uk'; }elseif ($_REQUEST['sendto']=='n') { $MyEmail = 'n@email.co.uk'; } . . . . 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 Edited January 10, 2013 by mhnd Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.