Hi, everyone im currently working on a switch statement which is almost finished but is missing one small thing. As you know a switch/case statement will test a condition and the outcome of that test will decide which case to execute.
Now the test is simply the users interaction. The Idea behind it is if the user clicks on a hyperlink titled books the switch statement would execute the code under 'books' or if he clicks 'DVDs' it will execute whatevers under DVDs.
The Problem: How do i get it to listen for whatever link the user clicks on??
The code so far is as follows:
<?php
$test = {whatever hyperlink they clicked}
switch ($test) {
case "Books":
//Select statement
$query = "SELECT *
FROM products
WHERE product_cat = 'books'";
break;
case "DVDs":
//Select statement
$query = "SELECT *
FROM products
WHERE product_cat = 'dvd'";
break;
Default:
//Select Statement
$query = "SELECT *
FROM products
WHERE product_cat = 'clothing'";
break;
}
//display items in specific categorys
while ($row = mysql_fetch_array($results)) {
extract($row);
echo "<p><a href=\"getcat.php?prodcat=" . $product_cat . "\">";
echo $product_cat;
}
?>[/COLOR]
Would i simply need to define each hyperlink with a "name='books'" ???