title: Trouble with retrieving data from mysql with HTML select box
body: <p>Okay so I am developing a search engine for a non-profit group using MYSQL and PHP.  The data appears fine from all the other fields.  But when I try to get data from a drop down select box the data doesn't appear.<br>
    I know my code is pron to SQL injections however there isn't any important data kept on the server, it just info about treatments and research studies.  </p>
  
  <p>I would like to do it with a function.  I was also wondering if there is anyway to retrieve data from multiple boxes.  Like I have a keyword search and a drop down combo box both of them are set.  How do I retrieve data from both columns in the database using the function I have?  Thanks 
  Here is my code if you guys could help me that would be great thanks
    The code for the html box</p>
  
  <pre><code>                          Broad Research Topic &lt;select name="Treatment1"&gt;
                            &lt;option value="Other"&gt;
                                      Other
                            &lt;/option&gt;
                            &lt;option value="Treatment"&gt;
                                      Treatment
                            &lt;/option&gt;
                            &lt;option value="PracticalCure"&gt;
                                      Practical Cure
                            &lt;/option&gt;
  </code></pre>
  
  <p>The php code to check if it is set</p>
  
  <pre><code>               if (isset($_GET['Treatment1']) &amp;&amp; in_array($_GET(['Treatment1']),       
                 array('Treatment', 'PracticalCure', 'Other')) {
  
  
                  $state =  $_GET['Treatment1']; 
                  Investigator6($state); }
                   }
  </code></pre>
  
  <p>The Function Investigator6</p>
  
  <pre><code>       function Investigator6($state)
         {
  
         $state = trim($state);
         $state = preg_replace('/\s+/', ' ', $state);
  
        //seperate multiple keywords into array space delimited
         $keywords = explode(" ", $state);
  
         //Clean empty arrays so they don't get every row as result
         $keywords = array_diff($keywords, array(
          ""
          ));
  
          //Set the MySQL query
          if ($state == NULL or $state == '%') {
           } else {
           for ($i = 0; $i &lt; count($keywords); $i++) {
          $query = ("SELECT * FROM Studies1 WHERE BroadResearchTopic LIKE   
         ' %$keywords[$i]%'");
         }
  
         //Store the results in a variable or die if query fails
         $result = mysql_query($query) or die(mysql_error());
         }
         if ($state == NULL or $state == '%') {
         } else {
         //Count the rows retrived
         $count = mysql_num_rows($result);
        echo $count;
        }
  
        //If search variable is null do nothing, else print it.
         if ($state == NULL) {
         } else {
         echo "You searched for &lt;b&gt;&lt;FONT COLOR=\"blue\"&gt;";
         foreach ($keywords as $value) {
          print "$value ";
         }
        echo "&lt;/font&gt;&lt;/b&gt;";
         }
         echo "&lt;p&gt; &lt;/p&gt;&lt;br /&gt;";
         echo "&lt;/center&gt;";
  
       //If users doesn't enter anything into search box tell them to.
       if ($state == NULL) {
      echo "&lt;center&gt;&lt;b&gt;&lt;FONT COLOR=\"red\"&gt;Please enter a search parameter to continue.                   
      b&lt;/font&gt;&lt;/b&gt;&lt;br /&gt;&lt;/center&gt;";
     } elseif ($state == '%') {
      echo "&lt;center&gt;&lt;b&gt;&lt;FONT COLOR=\"red\"&gt;Please enter a search parameter to continue.  
      &lt;/font&gt;&lt;/b&gt;&lt;br /&gt;&lt;/center&gt;";
      //If no results are returned print it
      } elseif ($count &lt;= 0) {
      echo "&lt;center&gt;&lt;b&gt;&lt;FONT COLOR=\"red\"&gt;Your query returned no results from the   
      database.&lt;/font&gt;&lt;/b&gt;&lt;br /&gt;&lt;/center&gt;";
      //ELSE print the data in a table
       } else {
      //Table header
       echo "&lt;center&gt;";
       echo "&lt;/center&gt;";
  
      //Colors for alternation of row color on results table
      $color1 = "#d5d5d5";
      $color2 = "#e5e5e5";
      //While there are rows, print it.
       while ($row = mysql_fetch_array($result)) {
          //Row color alternates for each row
          $row_color = ($row_count % 2) ? $color1 : $color2;
          //table background color = row_color variable
         echo "&lt;td style = \"padding: 10px\"&gt;" . $row['BroadResearchTopic'] . "&lt;/td&gt;";
         $row_count++;
         if ($state == NULL or $state == '%') {
         } else {
        //clear memory
        mysql_free_result($result);
       }
      }
  </code></pre>