Jump to content

[SOLVED] problem changing the display value of the second selection box


shadiadiph

Recommended Posts

I have been playing around with this all day. Problem is the second selection box when I change the first one it changes the selected value which is the one stored in the database but the second one I have had to just put change as the value I want this value to display as the one in the database and if onchange it changes. At the moment if i do this it would display the one saved in the database which doesn't make any sense as a choice if the user is changing from automobiles to boats as the one saved by the user will be the top selection even though that subcategory doesn't belong in the new category that has been selected.

Any ideas?

 

<?
$quer2=mysql_query("SELECT DISTINCT category,intCatID FROM tblcatdetails order by category"); 

if(isset($cat) and strlen($cat) > 0){
$quer=mysql_query("SELECT DISTINCT subcategory FROM tblsubcatdetails where intCatID=$cat order by subcategory"); 
}else{$quer=mysql_query("SELECT DISTINCT subcategory FROM tblsubcatdetails order by subcategory"); } 

echo "<select name='cat' onchange=\"reload(this.form)\" ><option value=''>$row[category]</option>";
while($noticia2 = mysql_fetch_array($quer2)) { 
if($noticia2['intCatID']==@$cat){echo "<option selected value='$noticia2[category]'>$noticia2[category]</option>"."<BR>";}
else{echo  "<option value='$noticia2[intCatID]'>$noticia2[category]</option>";}
}
echo "</select>";
?>
</td></tr>
<tr><td><span id="t_subcat">SUB CATEGORY </span></td></tr>
<tr><td>
<?
[color=orange]echo "<select name='subcat' ><option value=''>Change</option>"; [/color] 
while($noticia = mysql_fetch_array($quer)) { 
echo  "<option value='$noticia[subcategory]'>$noticia[subcategory]</option>";
}
echo "</select>";
;
?>

ok please forget it I have decided to reload the values to different page this should eliminate the problem.

 

problem was when the page reloaded it shoewd the subcategory which did not belong in the subcategory section as the category section had been changed.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.