grk101 Posted May 11, 2009 Share Posted May 11, 2009 thought i would post in here about this.. I have this html <span style="font-weight:bold">Are you available to coach?* </span> <label for="areyou"> <input type="radio" name="avcoach" id="avcoach" value="Yes"></label> Yes <label for="areyou"> <input type="radio" name="avcoach" id="avcoach" value="No"></label> No </td> <td> </td> </tr> <tr> <td colspan="5"><span style="font-weight:bold">If yes,</span> <label for="ifyes"> <input type="radio" name="coachrep" id="coachrep" value="Head Coach/Team Rep"></label> Head Coach/Team Rep <label for="ifyes"> <input type="radio" name="coachrep" id="coachrep" value="Assistant Coach/Team Rep"></label> Assistant Coach/Team Rep</td> Currently in my validation in php it makes both fields mandatory. like this if (strlen($avcoach) == 0 ) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please tell us if you can Coach/Rep</font></p>"); } if (strlen($coachrep) == 0 ) { die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please tell us if you want to be an Assistance Coach/Rep</font></p>"); } Realistically i wanted to do the following: Do you want to Coach/Rep , Yes then fill out the type of coach/Rep , but if not move on u know? So only make the following mandatory if they select YES from above. <span style="font-weight:bold">If yes,</span> <label for="ifyes"> <input type="radio" name="coachrep" id="coachrep" value="Head Coach/Team Rep"></label> Head Coach/Team Rep <label for="ifyes"> <input type="radio" name="coachrep" id="coachrep" value="Assistant Coach/Team Rep"></label> Assistant Coach/Team Rep Quote Link to comment Share on other sites More sharing options...
JD* Posted May 11, 2009 Share Posted May 11, 2009 On your validation page, have this: if($_POST['avcoach'] == "yes" && empty($_POST['coachrep'])) { die("Your error message here"); } 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.