Don't quite know how to work this one, any help would be much appreciated. So I'm trying to display the products which match the column of the link which have been clicked. I have succeeded in doing it for the search function when I click a button (Search). Now I'm trying to implement similar method for when a link is pressed.
$sql = "SELECT * FROM products ";
if(isset($_POST['Submit'])){
if(empty($_POST['Search'])){
$error = true;
}else{
$searchq = mysql_real_escape_string($_POST['Search']);
$searchq = preg_replace("#[^0-9a-z]#i","",$searchq);
$sql .= "WHERE type LIKE '%$searchq%' or name LIKE '%$searchq%'";
}
} $query = mysql_query($sql) or die(mysql_error());
The links are something like this, so when a user has clicked the link, it displays data according to name="" in link which matches the column type in the table products.
<ul>
<li name="Books" class="menu-781"><a href="#">Books</a></li>
<li name="Perfume" class="menu-780"><a href="#">Perfume</a></li>
<li name="Gifts" class="menu-789"><a href="#">Gifts</a></li>
<li name="Stationery" class="menu-778 last""><a href="#">Stationery</a></li>
</ul>
Thanks in advance.