title: how to search data from data base with multiselect or text box in php
body: <p>when an user search by category then data is display if an user want to search by mobile then data is display. </p>
  
  <p>user can search any record by category or by status or mobile.</p>
  
  <p>here is the code whatever i have tried.</p>
  
  <pre><code>     &lt;?php
       if(isset($_POST['submit']))
   {
     $status = $_POST['status'];
    $priority = $_POST['priority'];
     $ticket = $_POST['ticket'];
      $mobile = $_POST['mobile'];
        echo $mobile;
      $query = "SELECT * FROM ticketreg WHERE 1";
      if(isset($status) &amp;&amp; $status != '') {
     $query .= " And status Like'%$status%'";
     }
      if(isset($priority) &amp;&amp; $priority != '') {
     $query .= " OR priority Like'%$priority%'";
      }
     if(isset($ticket) &amp;&amp; $ticket != '') {
     $query .= " OR ticket Like '%$ticket%'";
    }
     if(isset($mobile) &amp;&amp; $mobile != '') {
    $query .= " OR EMAILID Like '%$mobile%'";
   }
  
  
  
  
  $result = mysql_query($query); 
  
  
  while($row = mysql_fetch_array($query))
   {
  
  
  
   ?&gt;
  </code></pre>
  
  <p>please give me some hint for this. here the html code.</p>
  
  <pre><code>   &lt;form name="frmSearch" method="post" action="searchresult.php"&gt;
        &lt;table width="100%" cellspacing="0" cellpadding="0" border="0" &gt;
    &lt;tbody&gt;
      &lt;tr&gt;
      &lt;td class="singup-text"&gt;Date : &lt;/td&gt;&lt;td width="5"&gt;&lt;/td&gt;
      &lt;td&gt; &lt;span style="font-size:12px; margin-right:3px;"&gt;From &lt;/span&gt;&lt;input id="date"            name="date" class="postsellbox1" style="width:75px; " type="text"&gt;
    &lt;span style="font-size:12px; margin-left:2px; margin-right:2px;"&gt;to &lt;/span&gt; &lt;input    id="date"  name="date" class="postsellbox1" style="width:75px; " type="text"&gt; 
  
     &lt;/td&gt;
       &lt;td class="singup-text" &gt;Status : &lt;/td&gt;&lt;td width="5"&gt;&lt;/td&gt;
       &lt;td&gt;&lt;select id="StatusDropDown" name="status" class="postsellbox"    style="width:130px;" &gt;
  
             &lt;option value="101"&gt;--Select--&lt;/option&gt;
            &lt;option value="search"&gt;pending&lt;/option&gt;
            &lt;option value="search"&gt;Assigned&lt;/option&gt;
          &lt;option value="search"&gt;Cancelled&lt;/option&gt;
          &lt;option value="104"&gt;Closed&lt;/option&gt;
  
          &lt;/select&gt;&lt;/td&gt;
          &lt;td class="singup-text" &gt;Priority : &lt;/td&gt;&lt;td width="5"&gt;&lt;/td&gt;
            &lt;td&gt;&lt;select id="PriorityDropDown" name="priority" class="postsellbox" style="width:130px;" &gt;
  
             &lt;option value="101"&gt;--Select--&lt;/option&gt;
            &lt;option value="101"&gt;High&lt;/option&gt;
            &lt;option value="102"&gt;Medium&lt;/option&gt;
            &lt;option value="103"&gt;Normal&lt;/option&gt;
  
  
          &lt;/select&gt;&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td height="15"&gt;&lt;/td&gt;&lt;/tr&gt;
        &lt;tr&gt;&lt;td class="singup-text" &gt;Category : &lt;/td&gt;&lt;td width="5"&gt;&lt;/td&gt;
           &lt;td&gt;&lt;select id="CategoryDropDown" name="category" class="postsellbox" style="width:130px;" &gt;
  
             &lt;option value="100"&gt;--Select--&lt;/option&gt;
          &lt;option value="101"&gt;Electricity&lt;/option&gt;
          &lt;option value="102"&gt;Painting&lt;/option&gt;
          &lt;option value="103"&gt;Plumbing&lt;/option&gt;
          &lt;option value="104"&gt;Carpentry&lt;/option&gt;
  
        &lt;/select&gt;&lt;/td&gt;
        &lt;td class="singup-text"&gt;Ticket : &lt;/td&gt;&lt;td width="5"&gt;&lt;/td&gt;
          &lt;td&gt;&lt;input id="ticket no."  name="ticket" class="postsellbox1" style="width:130px;" type="text" value=""&gt;&lt;/td&gt;
            &lt;td class="singup-text"&gt;Mobile : &lt;/td&gt;&lt;td width="5"&gt;&lt;/td&gt;
               &lt;td&gt;&lt;input id="Mobile"  name="mobile" class="postsellbox1" style="width:130px;" type="text"&gt;&lt;/td&gt;
              &lt;/tr&gt;
               &lt;tr&gt;
  
              &lt;td&gt;&lt;input class="submit" type="submit" value="Search" &gt;&lt;/td&gt;
             &lt;/tr&gt;
                  &lt;tr&gt;
  
           &lt;td&gt;&lt;input class="submit1" type="reset" value="Reset" &gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;/tbody&gt;&lt;/table&gt;
               &lt;/form&gt;
  </code></pre>