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 = "[email protected]"; $subject = "Contact Email"; $headers = "From:" . $email; mail($to,$subject,$msg,$headers); header("Location: mailreceived.html"); } else { $to = "[email protected]"; $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? 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. Link to comment https://forums.phpfreaks.com/topic/294469-what-am-i-doing-wrong/#findComment-1505217 Share on other sites More sharing options...
Landslyde Posted February 9, 2015 Author 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 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
Archived
This topic is now archived and is closed to further replies.