Click here to Skip to main content
15,071,262 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I am making a website of a resturant. in database I have created two tables

I want to display the category in navigation bar and on clicking the category it has to show the respected food that comes under the category.

example I have the following entries in my table
food_name=Zinger Burger,Chicken Burger,Sea Food

how can I show the category on menu bar as a hyperlink and on clicking the shows the food from database that is onclicking the fastfood it shows the zinger and chicken burger.

below is my work which I have done so far

 $query="Select * from category";
     <?php  $category["cat_name"]; <br mode="hold" /?>  
echo "<a href="\"show.php\"">  ".$category['cat_name'] ." </a>";
<?php <br mode="hold" /?>
//$food="Select * from food where cat_id={$category["cat_id"]} ";
        $query = "SELECT * ";
		$query .= "FROM subjects ";
		$query .= "WHERE cat_id=" . $category["cat_id"] ." ";

	echo"<li> {$foodname["food_name"]}</li>";
echo "";

Updated 6-Jul-12 23:48pm

1 solution

Just pass the category id in your show.php as query string and from there you may be able to query the food table.
wajahat134 9-Jul-12 4:19am
please elaborate how can I do it??

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900