title: Using value in drop down menu to search sql database
body: <p>I'm new with php and want to ask about this code.. I have one dropdown menu and one button..
  I want to search in sql database what I choose in those drop down menu..
  What is the sql syntax for search item in sql database by using drop down menu..
  By default, I write --> <code>SELECT * FROM helpline</code>.</p>
  
  <p>It should be --> <code>SELECT * FROM helpline WHERE MISC = %**item in drop down menu**%</code>.</p>
  
  <p>This is my database = helpdesk</p>
  
  <pre><code>Table = helpline
  
  NAME  |    DATE    |  MISC  |
  John  | 02/01/2011 | Item 1 |
  Mark  | 03/01/2011 | Item 2 |
  </code></pre>
  
  <p>This is my code</p>
  
  <pre><code>&lt;form id="form1" name="form1" method="post" action="&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;" &gt;
  &lt;label for="namelist"&gt;&lt;/label&gt;
  &lt;select name="namelist" id="namelist"&gt;
  &lt;option selected="selected" disabled="disabled"&gt;PLEASE CHOOSE ONE ITEM:-&lt;/option&gt;
  &lt;option&gt;Item 1&lt;/option&gt;
  &lt;option&gt;Item 2&lt;/option&gt;
  &lt;/select&gt;
  &lt;input type="submit" name="show" id="show" value="Submit" /&gt;
  &lt;?php
  mysql_select_db("helpdesk",mysql_connect("localhost","root",""))or die (mysql_error());
  $query = "SELECT * FROM helpline"; */ This line should select what I choose in drop down menu  /*
  $result = mysql_query($query);
  while ($row = mysql_fetch_array($result)){
  ?&gt;
  &lt;table border="0" cellpadding="6" cellspacing="6" class="curve"&gt;
  &lt;thead&gt;
  &lt;tr&gt;
  &lt;th&gt; &lt;div align="right"&gt;&lt;span class="font"&gt;NAME&lt;/span&gt;&lt;/div&gt;&lt;/th&gt;
  &lt;th&gt; &lt;div align="right"&gt;&lt;span class="font"&gt;DATE&lt;/span&gt;&lt;/div&gt;&lt;/th&gt;
  &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;   
  &lt;tr&gt;
  &lt;th&gt;&lt;div align="left"&gt;&lt;span class="font"&gt;&lt;?php echo $row['name']; ?&gt;&lt;/span&gt;&lt;/div&gt;&lt;/th&gt;
  &lt;td&gt;&lt;div align="left"&gt;&lt;span class="font"&gt;&lt;?php echo $row['date']; ?&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   
  &lt;/tr&gt;
  &lt;/tbody&gt;
  &amp;nbsp;
  &lt;?php
  }
  ?&gt;
  &lt;/table&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>So, it should display all items in sql database according to what I choose in drop down menu when I click the button..</p>