Tema: Checkbox
Ver Mensaje Individual
  #9 (permalink)  
Antiguo 04/12/2014, 21:56
Avatar de Maganius
Maganius
 
Fecha de Ingreso: septiembre-2010
Mensajes: 310
Antigüedad: 13 años, 7 meses
Puntos: 10
Respuesta: Checkbox

Perfecto ArturoGallegos

Se me habia olvidado que se le pueden asignar los índice.

para el que tenga duda de como armar el código, yo lo armé así.

Código HTML:
Ver original
  1. <form action="testsend.php" method="post">
  2. <input type="text" name="txt[0]" />
  3. <input type="checkbox" name="check[0]" value="1" />
  4.  
  5. <input type="text" name="txt[1]" />
  6. <input type="checkbox" name="check[1]" value="1" />
  7.  
  8. <input type="text" name="txt[2]" />
  9. <input type="checkbox" name="check[2]" value="1" />
  10. <input type="submit" />
  11. </form>

Código PHP:
Ver original
  1. foreach($_POST["txt"] as $key => $txt){
  2.         echo $txt."<br>";
  3.         echo $_POST["check"][$key]."<br>";
  4. }