Here is my seestore.php script. The basic layout of the page
is this:
Category 1
Category 2
Category 3
Category 4
Category 5
Category 6
Category 7
Category 8
Category 9
If someone clicks category 7, the result is this:
Category 1
Category 2
Category 3
Category 4
Category 5
Category 6
Category 7
Product
Product
Product
Category 8
Category 9
I would LIKE for it to do this so that the viewer without
question KNOWS something has changed with the page:
Category 7
Product
Product
Product
Category 1
Category 2
Category 3
Category 4
Category 5
Category 6
Category 8
Category 9
Here's the page script:
<?php
//connect to database
$conn = mysql_connect("localhost", "xxxxxx", "xxxxxx")
or die (mysql_error());
mysql_select_db("ppshea",$conn) or die (mysql_error());
$display_block = "<h1><font color=#808080 face=Arial, Helvetica, sans-serif>PPS Healthcare-Product Categories</h1>
<P>Select a category to see items available in that category.</p>";
//show categories first
$get_cats = "select id, cat_title, cat_desc from
store_categories order by cat_title";
$get_cats_res = mysql_query($get_cats) or die(mysql_error());
if (mysql_num_rows($get_cats_res) < 1) {
$display_block = "<P><em><font color=#808080 face=Arial,
Helvetica, sans-serif>Sorry, no categories to browse.</em></p>";
} else {
while ($cats = mysql_fetch_array($get_cats_res)) {
$cat_id = $cats[id];
$cat_title = strtoupper(stripslashes($cats[cat_title]));
$cat_desc = stripslashes($cats[cat_desc]);
$display_block .= "<p><strong><a
href=\"$_SERVER[PHP_SELF]?cat_id=$cat_id\">$cat_title</a></strong>
<br>$cat_desc</p>";
if ($_GET[cat_id] == $cat_id) {
//get items
$get_items = "select id, item_title, item_price
from store_items where cat_id = $cat_id
order by item_title";
$get_items_res = mysql_query($get_items) or die(mysql_error());
if (mysql_num_rows($get_items_res) < 1) {
$display_block = "<P><em><strong>Sorry, no items in
this category.</strong></em></p>";
} else {
$display_block .= "<ul>";
while ($items = mysql_fetch_array($get_items_res)) {
$item_id = $items[id];
$item_title = stripslashes($items[item_title]);
$item_price = $items[item_price];
$display_block .= "<li><a
href=\"showitem.php?item_id=$item_id\">$item_title</a>
</strong> (\$$item_price)";
}
$display_block .= "</ul>";
}
}
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>P.P.S. Healthcare.com</title>
</head>
<body>
<?php print $display_block; ?>
</body>
</html>
Does anyone know how I would accomplish this?
Thanks!
Allie