I am a newbie in PHP and I am really searching toward be enlightened within this simple program. The concept ended up being to first display all of the data within the table and also have the header clickable for sorting (I am completed with that) and also the title from the item to become clickable and become display in other detailpage.php file (completed with it too).

The issue was when our prof request use a search bar on the top on the table like filter which user could choose along with a textbox where they are able to input for that specific record. I am getting a difficult time exhibiting data in the filter using choose and textbox for specific record .

This really is my code. I did not include my detailpage.php

    <?php
    $connect = mysql_connect("localhost","root","");
    mysql_select_db("market",$connect);
    ?>

    <html>
    <head><title></title>
    <script type="text/javascript" >
          function ChangeColor(tableRow, highLight)
          {
    if (highLight)
        {
            tableRow.style.backgroundColor = '#7799ff';
        }
    else
        {
            tableRow.style.backgroundColor = 'white';
        }
      }
      function ChangeColor1(tableRow, highLight)
          {
    if (highLight)
        {
            tableRow.style.backgroundColor = '#736F6E';
            tableRow.style.color = 'white';
        }
    else
        {
            tableRow.style.backgroundColor = 'white';
            tableRow.style.color = 'black';
        }
      }

    </script>
    </head>
    <body  link="black" vlink="black" alink="black">
    <form name= 'check' method = 'post' action ='listpage.php'>
    <?php

    $conQuery= mysql_query("select * from Products");
    echo"<center><strong>Item List</strong></br></br>
    <table border='1' cellspacing = '0' cellpadding = '16'>";
    echo"<tr><td >Filter:

    <select id='look' name='look'>
    <option value=''></option>
    <option value='prod_name'>      Product Name    </option>
    <option value='prod_type'>      Product Type    </option>
    <option value='brand'>          Product Brand   </option>
    <option value='prod_details'>   Product Details </option>
    </select>";

    echo"<input type='text' id ='like 'name='like'>";
    echo"<input type='submit' name='go' value = 'Submit'>";
    echo"<input type='reset' value='Clear' >";
    echo"</td><tr>";
    echo"</table></center>";    

    if(isset($_POST['go']))
    {
     $filter= $_POST['look'];
     $find= $_POST['like'];
     //this is where the problem starts.. it says query was empty

     $conQuery1 = mysql_query("select * from Products WHERE $filter LIKE= %$find' ");
     $result = mysql_query($conQuery1)or die(mysql_error());   
     $ctr = 1;
      while($row = mysql_fetch_array($result))
  {
    $code=$row["prod_code"];
    $name=$row["prod_name"];
    $details=$row["prod_details"];
    $type=$row["prod_type"];
    $brand=$row["brand"];
    $price=$row["price"];
    echo"<tr onmouseover='ChangeColor1(this, true);' 
          onmouseout='ChangeColor1(this, false);'>
          <td>$ctr</td><td>$code</td>
    <td ><a href ='detailpage.php?name=$code'>$name</a></td>";      
    echo"<td>$details</td><td>$type</td>
    <td>$brand</td><td>";
    echo number_format($price,2); echo"</td></tr>";
    $ctr++;
  }

    }

        echo"</br><center><table border = '1' cellpadding = '5'>";
    echo"<tr><th>#</th>";       
    echo"<th onmouseover='ChangeColor(this,        true);'onmouseout='ChangeColor(this, false);'>";
    echo"<a href='listpage.php?name=ProdCodeASC';>Product Code</a></th>";             
    echo"<th onmouseover='ChangeColor(this, true);'onmouseout='ChangeColor(this, false);'>";
    echo"<a href='listpage.php?name=ProdNameASC';>Name</a></th>";             
    echo"<th onmouseover='ChangeColor(this, true);'onmouseout='ChangeColor(this, false);'>";
    echo"<a href='listpage.php?name=ProdDetailsASC';>Details</a></th>";           
    echo"<th onmouseover='ChangeColor(this, true);'onmouseout='ChangeColor(this, false);'>";
    echo"<a href='listpage.php?name=ProdTypeASC';>Type</a></th>";             
    echo"<th onmouseover='ChangeColor(this, true);'onmouseout='ChangeColor(this, false);'>";
    echo"<a href='listpage.php?name=ProdBrandASC';>Brand</a></th>";           
    echo"<th onmouseover='ChangeColor(this, true);'onmouseout='ChangeColor(this, false);'>";
    echo"<a href='listpage.php?name=ProdPriceASC';>Price</a></th>";
    echo"</tr>";


           $ctr = 1;
           if(isset($_GET["name"]))
           {
             $name=$_GET["name"];
         if($name=="ProdNameASC")
         {
        $conQuery= mysql_query("select * from Products order by prod_name ASC");        
         }
         if($name=="ProdCodeASC")
         {
        $conQuery= mysql_query("select * from Products order by prod_code ASC");        
         }
         if($name=="ProdDetailsASC")
         {
        $conQuery= mysql_query("select * from Products order by prod_details ASC");     
         }
         if($name=="ProdTypeASC")
         {
        $conQuery= mysql_query("select * from Products order by prod_type ASC");        
         }
         if($name=="ProdBrandASC")
         {
        $conQuery= mysql_query("select * from Products order by brand ASC");        
         }
         if($name=="ProdPriceASC")
         {
        $conQuery= mysql_query("select * from Products order by price ASC");    
         }
            }


    while($row = mysql_fetch_array($conQuery))
{
$code=$row["prod_code"];
$name=$row["prod_name"];
$details=$row["prod_details"];
$type=$row["prod_type"];
$brand=$row["brand"];
$price=$row["price"];
echo"<tr onmouseover='ChangeColor1(this, true);' 
          onmouseout='ChangeColor1(this, false);'>
          <td>$ctr</td><td>$code</td>
<td ><a href ='detailpage.php?name=$code'>$name</a></td>";      
echo"<td>$details</td><td>$type</td>
<td>$brand</td><td>";
echo number_format($price,2); echo"</td></tr>";
$ctr++;
}

    ?>
    </table></center>



    </form>
    </body>
    </html>
    <?php
    mysql_close($connect);
    ?>