I am trying to hide or show an entire list box based on what the user selects and i am not entirely sure how to do it. i am wanting the user to select either school or city in the first list and based on the decision i want the following list box to appear. I am not sure if radio buttons would be better because i don't know anything about them. form name="school"> <select name="type"> <option value="school" selected="selected">School</option> <option value="city">City</option> </select> <select name="school"> <option value="North Central MO College" selected="selected">North Central MO College</option> </select> <select name="city"> <option value="Trenton" selected="selected" >Trenton</option> </select> </form> PHP: thanks
Not Tested!! <form name="school"> <select name="type"> <option> ---- </option> <option value="school" onclick="document.getElementById('City').disabled=true;document.getElementById('school').disabled=false;">School</option> <option value="city" onClick="document.getElementById('school').disabled=true;document.getElementById('city').disabled=false;">City</option> </select> <select name="school" id="school"> <option value="North Central MO College" selected="selected">North Central MO College</option> </select> <select name="city" id="city"> <option value="Trenton" selected="selected" >Trenton</option> </select> </form> Code (markup):
To hide things, wrap them in divs with style display inline and when hiding, change inlink to none. Peace,
That is a javascript issue and php isn't going to hide a select box after you selected something unless they press the SUBMIT button and the server gets a chance to process the form. Otherwise i would stick with JavaScript and not php.