Código PHP:
<form name="formulario2" action="?" method="get" onSubmit='return validar2(this)'>
<strong><?php echo $lang['SEARCH_TITLE']; ?></strong><br>
<input type="hidden" name="cityid" value="<?php echo $xcityid; ?>">
<input type="hidden" name="lang" value="<?php echo $xlang; ?>">
<input onKeyUp="formulario2.search.value=formulario2.search.value.toLowerCase()" name="search" type="text" value="<?php echo $_GET['search']; ?>" size="37" maxlength="50">
<select>
<option value="0" <?php if(!$_GET['subcatid']) echo "selected"; ?>><?php echo $lang['ALL_CATEGORIES']; ?></option>
<?php
$sql = "SELECT catid, catname
FROM $t_cats
ORDER BY catname";
$res = mysql_query($sql);
while ($row=mysql_fetch_array($res))
{
echo "<option value=\"$row[catid]\"";
if ($_GET['catid'] == $row['catid'])
{
echo " selected";
$cat = $row['catname'];
}
echo ">$row[catname]</option>";
$sql = "SELECT subcatid, subcatname
FROM $t_subcats
WHERE catid = $row[catid]
ORDER BY subcatname";
$ress = mysql_query($sql);
if (mysql_num_rows($ress))
{
while ($s = mysql_fetch_array($ress))
{
echo "<option value=\"$s[subcatid]\"";
if ($_GET['subcatid'] == $s['subcatid'])
{
echo " selected";
$subcat = $s['subcatname'];
}
echo ">· $s[subcatname] </option>";
}
}
}
?>
</select>
<input type="hidden" name="view" value="ads">
<input type="submit" value="<?php echo $lang['SEARCH']; ?>" name="Buscar">
<br>
<?php echo $lang['ADS_WITH_IMAGES']; ?>: <input name="images_only" type="checkbox" value="1" <?php if ($_GET['images_only']==1){echo 'checked';}?>>
<?php echo $lang['GLOBAL_SEARCHS']; ?>: <input name="global" type="checkbox" value="yes" <?php if ($_GET['global']=="yes"){echo 'checked';}?>>
</form>
El problema es que necesito asignar "catid" o "subcatid" al name del select ya que este contiene tanto las categorías como las subcategorias ,.. llevo dias y he probado de todo ,.. agradecería alguna ayuda