Ver Mensaje Individual
  #1 (permalink)  
Antiguo 23/09/2009, 21:48
Avatar de xArchangellx
xArchangellx
 
Fecha de Ingreso: octubre-2008
Ubicación: Peru
Mensajes: 208
Antigüedad: 15 años, 6 meses
Puntos: 5
Pregunta Problema con checkbox

MI problema es sencillo para ustedes q dominan este lenguaje, mi problema es el siguiente:
Tengo un formulario con un usuario y 3 checkbox, quiero elegir mas de 2 opciones en el check, pero solo puedo elegir una q hago??

EL CODIGO HTML ES:
<form>
<input type="text" name="nombres" />
Futbol<input type="checkbox" name="deporte" value="0" />
Voley<input type="checkbox" name="deporte" value="1"/>
Basquet<input type="checkbox" name="deporte" value="2" />
</fomr>

EL CODIGO PHP ES:
<?php
$n= $_POST[nombres];
$af= $_POST[deporte];

if ($af == 0){
$afc="futbol";
}

else
if ($af == 1){
$afc="voley";
}

else
if ($af == 2){
$afc="basquet";
}

echo "Mi nombre es $n mi deporte es $afc";
?>

EL PROBLEMA Q SOLO ELIGE UNA OPCION, PERO SI YO MARCO FUTBOL Y BASQUET SOLO ME ARROJA UN DEOPRTE, COMO HAGO PARA Q ME ARROJE DOS A MAS DEPORTES
GRACIAS ESPERO RESPUESTAS