Hi there,
I've got a question about an odd annoyance that's been happening on our new php form. The form originally had javascript controlled dynamic dropdown boxes which would force the user to complete the form in order (ie you can't click the team dropdown until you've chosen a league - which populates the team dropdown with ONLY teams from the chosen league).
Anyway, the situation I ran into was that some users without Javascript enabled couldn't complete the form (as the reload and unlock subsequent dropdowns code wasn't understood). To get around this, I have made it possible to still select from the second dropdown box even if the form hadn't reloaded.
THE PROBLEM: When users have javascript enabled and select a league, the page reloads and the team dropdown lists teams in that league in order (team 1, team 2, etc.). THAT'S GOOD!
If javascript is not enabled, they have to select from the team dropdown which contains every team in every league, but for some reason the teams are sorted improperly. THAT'S BAD!
For instance, team order in the dropdown might be:
team 1 from league 1
team 2 from league 1
team 5 from league 1
team 3 from league 1 etc....
All the teams that should be there ARE there, but they are in sporadic order, which will confuse the user, not to mention how tacky it looks.
[PHP]/////// for second drop down list we will check if category is selected else we will display all the subcategory/////
if(isset($cat) and strlen($cat) > 0){
$quer=mysql_query("SELECT DISTINCT subcategory FROM subcategory where cat_id=$cat order by subcategory");
}else{$quer=mysql_query("SELECT DISTINCT subcategory FROM subcategory ".$filter." order by cat_id"); }
////////// end of query for second subcategory drop down list box ///////////////////////////[/PHP]
That's the main query for the team dropdown, and variable $filter is a simple where-statement.
My backend MySQL is sorted in logical order. Does anyone have an idea as to why this happening??