PHP - checkbox

 
Vista:

checkbox

Publicado por andres gomez (1 intervención) el 24/08/2010 21:26:05
hola... tengo un conjunto de checkbox

<input type="checkbox" name="c1" value="1" /> OPCION1
<input type="checkbox" name="c1" value="2" /> OPCION2
<input type="checkbox" name="c1" value="3" /> OPCION3
<input type="checkbox" name="c1" value="4" /> OPCION4
<input type="checkbox" name="c1" value="5" /> OPCION5
<input type="checkbox" name="c1" value="6" /> OPCION6
<input type="checkbox" name="c1" value="7" /> OPCION7

estos los envio con un formulario......
como puedo recuperar los valores del chekbox? para saber cuales selecciono y cuales no....

gracias
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:checkbox

Publicado por jUAN CARLOS (1 intervención) el 24/08/2010 21:57:33
HOLA

PRIMERO Q TODO..... SE PONDRIA ASI

<input type="checkbox" name="c1[]" value="1" /> OPCION1
<input type="checkbox" name="c1[]" value="2" /> OPCION2
<input type="checkbox" name="c1[]" value="3" /> OPCION3
<input type="checkbox" name="c1[]" value="4" /> OPCION4
<input type="checkbox" name="c1[]" value="5" /> OPCION5
<input type="checkbox" name="c1[]" value="6" /> OPCION6
<input type="checkbox" name="c1[]" value="7" /> OPCION7

DESPUES DE ENVIAR EL FORMULARIO:
$Opciones = $_POST['c1'];

PARA VERIFICAR Q ESTAN RECUPERANDO TODO:
foreach ($Opciones as $id){
echo $id."<br>";
}

Y LISTO
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar