shadiadiph Posted December 29, 2008 Share Posted December 29, 2008 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>"; ; ?> Link to comment https://forums.phpfreaks.com/topic/138698-solved-problem-changing-the-display-value-of-the-second-selection-box/ Share on other sites More sharing options...
gevans Posted December 29, 2008 Share Posted December 29, 2008 I don't know if it's just me, but I couldn't really understand the question. I gather one of the select boxes is not doing what you want it to. Could you re-write the question? Link to comment https://forums.phpfreaks.com/topic/138698-solved-problem-changing-the-display-value-of-the-second-selection-box/#findComment-725260 Share on other sites More sharing options...
shadiadiph Posted December 29, 2008 Author Share Posted December 29, 2008 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. Link to comment https://forums.phpfreaks.com/topic/138698-solved-problem-changing-the-display-value-of-the-second-selection-box/#findComment-725676 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.