Latest Lists

HTML dropdown list. How can I create an 'any' option to search all values?

I have a form with drop down options. The form works fine, but you must make a selection in order to find results. How can I add an 'any' value into some of the dropdowns to search all data?

Public Comments

  1. I would do something like this <select name="search"> <option value="People">People</option> <option value="Animals">Animals</option> <option value="*">Search All</option> </select> and in your php or what ever language search script just do something like this <? PHP switch($_GET['search']) { case($_GET['search'] = "People"): //run your query here and return the results like $query = mysql_query("SELECT * FROM Table_Name WHERE Search_Column='$_Get['search']'"); break; case($_GET['search'] = "*"): //run your query here and return the results like $query = mysql_query("SELECT * FROM Table_Name"); break; } ?>
Powered by Yahoo! Answers