Hey
I have a bunch of categories in my database and I am making the user go through them all simply through a form that ends when the category their on does not have any more subcategories.
My issue is that I want to trace the Category ID's that the user have chosen when he's at the point of where there are not more categories to choose from.
Could you please help me figure out a way of doing this? I assume it's through an array, and I have tried by adding
<input name=catlistarray[] value=$row[catid]>
but it does not keep the value from the previously submitted form.
I just get the very last Category ID submitted.
Here is the code I am using, hope you can help.
//Start listing the categories
$getcat = mysql_query("SELECT * FROM classifieds_cat WHERE cat_undercat = '$catid'") or die("Category not found: " . mysql_error());
$count = mysql_num_rows($getcat);
if(!$count == 0) {
echo "
Where do you want your ad?<br>
<br>
<b>Choose Your Category:</b><br>
<table>
<form name=mainform action=\"postad.php\" method=\"post\">
<input type=hidden name=adtype value=\"$adtype\">
<input type=hidden name=\"catlist[]\" value=\"$catid\">
<tr><td valign=top>
";
}
while ($row = mysql_fetch_array($getcat, MYSQL_ASSOC)) {
if($catid==$row['cat_id']) { $checked = "checked"; } else { $checked = ""; }
echo "<input type=\"radio\" name=\"catid\" value=\"$row[cat_id]\"$checked onclick=\"mainform.submit()\"> $row[cat_title]<br>";
unset($checked);
}
if(!$count == 0) {
echo "
</select>
</td><td>
<input type=submit value=GO>
</td></tr>
</form>
</table>
";
exit; }
//End of category listing
Please if you can.