Hi
I have 2 drop down fields in an array:
The array works perfectly, (and is part of a longer form) but when I submit, the data disappears. I'm not that bothered about the 2nd drop down being sticky but really need the selection of the first drop down to remain after the submit.
Any help would be great....
<?php
@$cat=$_GET['cat']; // Use this line or below line if register_global is off
//@$cat=$HTTP_GET_VARS['cat']; // Use this line or above line if register_global is off
///////// Getting the data from Mysql table for first list box//////////
$quer2=mysql_query("SELECT DISTINCT prop_type,proptype_id FROM prop_types order by prop_type");
///////////// End of query for first list box////////////
if(isset($cat) and strlen($cat) > 0){
$quer=mysql_query("SELECT DISTINCT prop_subtype FROM prop_subtypes where proptype_id=$cat order by prop_subtype");
}
////////// end of query for second prop_subtype drop down list box ///////////////////////////
////////// Starting of first drop downlist /////////
echo "<select name='cat' onchange=\"reload(this.form)\"><option value=''>Select One</option>";
while($noticia2 = mysql_fetch_array($quer2)) {
if($noticia2['proptype_id']==@$cat){echo "<option selected value='$noticia2[prop_type]'>$noticia2[prop_type]</option>"."<BR>";}
else{echo "<option value='$noticia2[proptype_id]'>$noticia2[prop_type]</option>";}
}
echo "</select>";
////////////////// This will end the first drop down list ///////////
echo "<BR>";
?></td>
</tr>
<tr>
<td class="maintextnopad">Subtype:</td>
<td align="left"><?php
////////// Starting of second drop downlist /////////
echo "<select name='subcat'><option value=''>Select One</option>";
while($part = mysql_fetch_array($quer)) {
echo "<option value='$part[prop_subtype]'>$part[prop_subtype]</option>";
}
echo "</select>";
////////////////// This will end the second drop down list ///////////
?>