Landslyde Posted February 9, 2015 Share Posted February 9, 2015 I have a form set up. One part of that form is a couple radio buttons. The form code for them is: <label for="who" class="label">Email to:</label> <input type="radio" name="who" value="Sales" checked>Sales <input type="radio" name="who" value="Support">Support In my PHP code, I have this to check which one they selected: if($who=="Sales") { $to = "sales@mysite.co"; $subject = "Contact Email"; $headers = "From:" . $email; mail($to,$subject,$msg,$headers); header("Location: mailreceived.html"); } else { $to = "support@mysite.co"; $subject = "Contact Email"; $headers = "From:" . $email; mail($to,$subject,$msg,$headers); header("Location: mailreceived.html"); } But even when I select the Sales radio button, the email is sent to Support. What am I not doing right in my If statement? Quote Link to comment https://forums.phpfreaks.com/topic/294469-what-am-i-doing-wrong/ Share on other sites More sharing options...
PravinS Posted February 9, 2015 Share Posted February 9, 2015 echo tha $_POST['who] value at the top and check what value you are getting after submitting the form. Quote Link to comment https://forums.phpfreaks.com/topic/294469-what-am-i-doing-wrong/#findComment-1505217 Share on other sites More sharing options...
Solution Landslyde Posted February 9, 2015 Author Solution Share Posted February 9, 2015 I got it. I forgot to set my PHP variable $who with the form value of "who". Has been a long day...time to go to bed now Quote Link to comment https://forums.phpfreaks.com/topic/294469-what-am-i-doing-wrong/#findComment-1505219 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.