Hi, I am building a left navigation bar with about 10 categories. I need an IF statement within the below if statement that identifies when a particular category is clicked: if(isset($_GET['category'])) { $selcat = $_GET['category']; } This code works fine for all categories whereby a list of products is displayed below the category link clicked. But this does not work for Accessories. In this case it should first display a list of Manufacturers first, then when manufacturer is clicked it suggests product model numbers, after that the accessories. So I need something in the above code saying: If the $_GET['category'] = 8 then $selcat1=$_GET['category'] otherwise $selcat = $_GET'[category'] How do I code this?? Matt.
Should be if($_GET['category'] == 8) { $selcat1 = $_GET['category']; } else { $selcat = $_GET['category'] } Remember to use double equals (==) when comparing, otherwise you'll reset your variable. Also, this code sounds somewhat inefficient. Not that it wont work, but you might consider an AJAX category menu, if I understand your problem correctly. At the very least, I would suggest you look up switch/case statements. They can replace large blocks of if/else statements and are (usually) faster. ie switch($_GET['category']) { case(1) { //do what you need break; case(2) { //do what you need in this case break; default: $selcat = $_GET['category']; break; }