title: Creating a mySQL query using PHP form dropdowns - If user ignores dropdown, do not filter by that parameter
body: <p>I am creating a simple MySQL query that will be built from the user selecting options from 2 dropdowns.</p>
  
  <p>The issue I am having is that I would like each drop down to default that if they do not actually choose an option, do not filter by that dropdown parameter.</p>
  
  <p>So, if they come in, and simply hit submit without choosing from a dropdown they should see everything.  If they come in and pick from only one of the dropdowns, the query will basically ignore filtering by the other dropdown.</p>
  
  <p>I tried making <code>&lt;OPTION VALUE='any'&gt;Choose</code> but my query didn't know what to do with the 'any' and just shows no results.</p>
  
  <p>Here is my code.  Thank you very much for whatever help you can provide.</p>
  
  <p><strong>FORM</strong></p>
  
  <pre><code>&lt;form method="POST"  action="&lt;?php echo $_SERVER['REQUEST_URI']; ?&gt;"&gt;
  
  
  &lt;select name="GameType"&gt; 
  &lt;OPTION VALUE='any'&gt;Choose Game Type
  &lt;option value="Game1"&gt;Option 1&lt;/option&gt;
  &lt;option value="Game2"&gt;Option 2&lt;/option&gt;
  &lt;option value="Game3"&gt;Option 3&lt;/option&gt;
  &lt;/select&gt;
  
  
  &lt;select name="Instructor"&gt; 
  &lt;OPTION VALUE='any'&gt;Choose Instructor
  &lt;option VALUE="InstructorA"&gt;Instructor A&lt;/option&gt;
  &lt;option value="InstructorB"&gt;Instructor B&lt;/option&gt;
  &lt;option value="InstructorC"&gt;Instructor C&lt;/option&gt;
  &lt;/select&gt;
  
  &lt;input type='submit' value='Search Videos'&gt;  
          &lt;/form&gt;
  </code></pre>
  
  <p><strong>MYSQL</strong></p>
  
  <pre><code>&lt;?PHP
  
   connection stuff
  
  $db_handle = mysql_connect($server, $user_name, $password);
  $db_found = mysql_select_db($database, $db_handle);
  
  if ($db_found) {
  $SQL = "SELECT * FROM Videos WHERE GameType=\"{$_POST['GameType']}\" AND Instructor=\"{$_POST['Instructor']}\"";
  $result = mysql_query($SQL);
  
  while ($db_field = mysql_fetch_assoc($result)) {
  
  echo $db_field['ShortDescription'] . ", ";
  echo $db_field['LongDescription'] . ", ";
  echo $db_field['GameType'] . ", ";
  echo $db_field['NumberOfPlayers'] . ", ";
  echo $db_field['Instructor'] . ", ";
  echo $db_field['Stakes'] . ", ";
  echo $db_field['UserPermissionLevel'] . ", ";
  echo $db_field['DateCreated'] . "&lt;BR&gt;";
  
  }
  
  mysql_close($db_handle);
  
  }
  else {
  print "Database NOT Found ";
  mysql_close($db_handle);
  }
  
  
  
  
  ?&gt;
  </code></pre>