Ver Mensaje Individual
  #2 (permalink)  
Antiguo 16/06/2008, 17:03
filzix
 
Fecha de Ingreso: junio-2008
Mensajes: 30
Antigüedad: 16 años, 10 meses
Puntos: 1
Respuesta: Switch de 1 variable con varios valores

prueba esto a ver si te gusta.

Código PHP:
<?php
if(isset($_POST[enviar])){
    if(!empty(
$_POST[hobbie])){
        foreach(
$_POST[hobbie] as $value){
            echo 
"You like ".$value.".<br>";
        }
    
    } else {
        echo 
"You did not select any listed hobbie.";
    }

}
?>

<br /><br />
You like:<br />
<form method="post" action="check.php">
<input type="checkbox" name="hobbie[]" value="to dance"  />to dance<br />
<input type="checkbox" name="hobbie[]" value="to throw stuff out the window"  />to throw stuff out the window<br />
<input type="checkbox" name="hobbie[]" value="to adopt foreign kids"  />to adopt foreign kids<br />
<input type="checkbox" name="hobbie[]" value="PC's"  />PC's<br />
<input type="checkbox" name="hobbie[]" value="to handstand"  />to handstand<br />
<input type="submit" name="enviar" value="Enviar" />
</form>