Log in

View Full Version : Change subcategories values...



pavmoxo
06-27-2006, 11:43 AM
I have 2 dropdown that I have to associate:


This is the category dropdown:

<select name="cat_ID" id="cat_ID" tabindex="3">
<?
$sql = "select cat_ID, cat_nome from cat_links order by cat_nome" ;
$query = query($sql);
$conta = mysql_num_rows($query);
for ($i=0;$i<$conta;$i++)
{
$arrl = mysql_fetch_array($query);
?>

<option value="<?php echo $arrl["cat_ID"]; ?>"><?php echo $arrl["cat_nome"]; ?></option>
<? } ?>

</select>

And this is the subcategory dropdown:

<select name="subcat_ID" id="subcat_ID" tabindex="3">
<?
$sql = "select s.subcat_ID, s.subcat_nome from subcat_links s, cat_links c where c.cat_ID = ".$arrl["cat_ID"]." order by s.subcat_nome" ;
$query = query($sql);
$conta = mysql_num_rows($query);
for ($i=0;$i<$conta;$i++)
{
$arrl = mysql_fetch_array($query);
?>

<option value="<?php echo $arrl["subcat_ID"]; ?>"><?php echo $arrl["subcat_nome"]; ?></option>
<? } ?>

</select>


What I want is when in choose a category, the subcategories will change to correpond. Can you help me??

pavmoxo
07-04-2006, 06:33 PM
Do you have any ideia for resolve this case?? Do you have a script example for this for correspond Categories and subCategories that are in a mySql DB??
I really need your help!!!....