HormonX
01-28-2003, 04:20 PM
Hi,
amhaving a little problem and i don't know how to overcome it. Here it is ....
I have a template page i have done with a pull down menu. Menu items are taken from a database of products. Manu dispalys only product categories but when you select a product it takes you to other page where subcategoris for that particular category should be displayed .. ( pull down menu stays on the page because it's a part of the template). Everything would work fine but doesn't matter if i select first option or any other the result on the other page will only list subcategory of the last selection on the pull down menu.
please help me :)
this is menu section that appears on all pages. this where you make your selection ... page name index.php
<?
include('connect.php');
$query = "SELECT DISTINCT prod_id, prod_cat FROM products ORDER BY prod_cat ASC";
$result = mysql_query($query, $link);
?>
<select name="menu1" onChange="MM_jumpMenu('parent',this,0)" class="formelements">
<option selected>Select One</option>
<?
while($r=mysql_fetch_array($result))
{
$prod_id = $r['prod_id'];
$prod_cat = $r['prod_cat'];
?>
<option value="../inv.php?prod_id=<? echo "$prod_id"; ?>"><? echo "$prod_cat"; ?></option>
<?
}
?>
subcategories should be listed according tothe selection made ... page name inv.php
<?
$query = "SELECT DISTINCT sprod_cat, sprod_id FROM products WHERE prod_id='$prod_id'";
$result = mysql_query($query, $link);
while($r1=mysql_fetch_array($result))
{
$sprod_cat = $r1['sprod_cat'];
$sprod_id = $r1['sprod_id'];
?>
<tr>
<td class="smallletters"><a href="invdet.php?sprod_id=<? echo "$sprod_id"; ?>"><? echo "$sprod_cat"; ?></a></td>
</tr>
<?
}
any help you be very very very appeciated.
HormonX
amhaving a little problem and i don't know how to overcome it. Here it is ....
I have a template page i have done with a pull down menu. Menu items are taken from a database of products. Manu dispalys only product categories but when you select a product it takes you to other page where subcategoris for that particular category should be displayed .. ( pull down menu stays on the page because it's a part of the template). Everything would work fine but doesn't matter if i select first option or any other the result on the other page will only list subcategory of the last selection on the pull down menu.
please help me :)
this is menu section that appears on all pages. this where you make your selection ... page name index.php
<?
include('connect.php');
$query = "SELECT DISTINCT prod_id, prod_cat FROM products ORDER BY prod_cat ASC";
$result = mysql_query($query, $link);
?>
<select name="menu1" onChange="MM_jumpMenu('parent',this,0)" class="formelements">
<option selected>Select One</option>
<?
while($r=mysql_fetch_array($result))
{
$prod_id = $r['prod_id'];
$prod_cat = $r['prod_cat'];
?>
<option value="../inv.php?prod_id=<? echo "$prod_id"; ?>"><? echo "$prod_cat"; ?></option>
<?
}
?>
subcategories should be listed according tothe selection made ... page name inv.php
<?
$query = "SELECT DISTINCT sprod_cat, sprod_id FROM products WHERE prod_id='$prod_id'";
$result = mysql_query($query, $link);
while($r1=mysql_fetch_array($result))
{
$sprod_cat = $r1['sprod_cat'];
$sprod_id = $r1['sprod_id'];
?>
<tr>
<td class="smallletters"><a href="invdet.php?sprod_id=<? echo "$sprod_id"; ?>"><? echo "$sprod_cat"; ?></a></td>
</tr>
<?
}
any help you be very very very appeciated.
HormonX