Ver Mensaje Individual
  #3 (permalink)  
Antiguo 31/01/2011, 08:04
visona
 
Fecha de Ingreso: febrero-2008
Mensajes: 675
Antigüedad: 17 años, 1 mes
Puntos: 5
Respuesta: Insertar con foreach

este es el codigo que tengo
Código PHP:
foreach($_POST['nombre'] as $key => $valor2) {
  
$insertSQL sprintf("INSERT INTO cajas (dentro_caja, sexo_caja, edad_caja, tipo_caja, temporada, cantidad) VALUES (%s, %s, %s, %s, %s, %s)",
                       
GetSQLValueString($valor2 "text"),
                       
GetSQLValueString($_POST['sexo'], "text"),
                       
GetSQLValueString($_POST['talla'], "text"),
                       
GetSQLValueString($_POST['tipo'], "text"),
                       
GetSQLValueString($_POST['temporada'], "text"),
                       
GetSQLValueString($_POST['cantidad'][$key], "text")); 
Y los campos del form
Código PHP:
<input type="checkbox" name="nombre[]" id="nombre[]" value="<?php echo $row_articulos['articulo']; ?>"/>
<input name="cantidad[]" type="text" id="cantidad[]" value="0" size="2" />