Ciao a tutti, con aiuto di un mio amico ho scitto questo codice:
In cui il primo select "sezione" dovrebbe far variare il select "categoria" ovviamente questo codice non funziona.Codice PHP:
Sezione:<br>
<?php echo "<select onchange=\"document.location.href = '" . $_SERVER['PHP_SELF'] . "?sezione=' + this.value;\">";?>
<option value="microsoft">Microsoft</option>
<option value="apple">Apple</option>
<option value="office">Office</option>
<option value="sicurezza">Sicurezza</option>
<option value="multimedia">Multimedia</option>
<option value="internet">Internet</option>
<option value="im">I'M</option>
<option value="live">Live</option>
<option value="hardware">Hardware</option>
<option value="mobile">Mobile</option>
<option value="techouse">Tech House</option>
</select>
<br>
<br>
<?php
echo "<select name='categoria'>";
swicth ( $_GET['sezione'] ) {
case 'microsoft':
echo "<option value='1'>OS</option>";
echo "<option value='2'>Software</option>";
echo "<option value='3'>Prodotti</option>";
echo "<option value='4'>News</option>";
break;
case 'apple':
echo "<option value='1'>OS</option>";
echo "<option value='2'>Software</option>";
echo "<option value='3'>iPod e iPhone</option>";
echo "<option value='4'>Prodotti</option>";
echo "<option value='5'>News</option>";
break;
case 'office':
echo "<option value='1'>Write</option>";
echo "<option value='2'>Grafica</option>";
echo "<option value='3'>Prodotti</option>";
echo "<option value='4'>Studenti</option>";
echo "<option value='5'>News </option>";
break;
case 'sicurezza':
echo "<option value='1'>Computer</option>";
echo "<option value='2'>Mobile</option>";
echo "<option value='3'>House</option>";
echo "<option value='4'>Prodotti</option>";
echo "<option value='5'>News </option>";
break;
case 'multimedia':
echo "<option value='1'>Software</option>";
echo "<option value='2'>Mobile </option>";
echo "<option value='3'>Prodotti</option>";
echo "<option value='4'>News</option>";
break;
case 'internet':
echo "<option value='1'>Software</option>";
echo "<option value='2'>P2P</option>";
echo "<option value='3'>Mobile</option>";
echo "<option value='4'>Prodotti</option>";
echo "<option value='5'>News</option>";
break;
case 'im':
echo "<option value='1'>Skipe</option>";
echo "<option value='2'>Mobile</option>";
echo "<option value='3'>Prodotti</option>";
echo "<option value='4'>News</option>";
break;
case 'live':
echo "<option value='1'>Messenger</option>";
echo "<option value='2'>Spaces</option>";
echo "<option value='3'>Servizi</option>";
echo "<option value='4'>Programmi</option>";
echo "<option value='5'>News</option>";
break;
case 'hardware':
echo "<option value='1'>No Sub Category</option>";
break;
case 'mobile':
echo "<option value='1'>Software</option>";
echo "<option value='2'>News</option>";
break;
case 'techouse':
echo "<option value='1'>Ambieti</option>";
echo "<option value='2'>Prodotti</option>";
echo "<option value='3'>News</option>";
break;
}
echo "</select>";<br>
?>
Mi potreste aiutare a trovare l'errore???
Grazie