I have a HTML/PHP/MYSQL setup where I want to use a value chosen from one HTML <SELECT> to restrict values shown in the next HTML <SELECT>. It's a reasonably common requirement but I just can't get it. A good example is where the user chooses a country and then the next choice is restricted to valid states for that country and then when they choose a state the next choice is only valid cities for that state.
I can do the database queries Ok, but its knowing exactly what to query for that bugs me.
<td valign="middle"> <select name="ttypec" id="ttypec" onchange="return getTypeCPtr();\"> <?php typec_list('con','no'); ?> </select> </td> <td valign="middle"> <select name="tcomp"> <?php comp_list('con','no',$TCPtr); ?> </select> </td>
What I want to do is get that choice (by number or string) and use it in the php routine "comp_list()" to restrict that choices shown in that list.
Maybe this isn't the best way to do what I want, so I would welcome comments on that as well. Any help would be greatly appreciated.