
01/12/2005, 06:26
|
| | Fecha de Ingreso: noviembre-2005
Mensajes: 45
Antigüedad: 19 años, 3 meses Puntos: 1 | |
la verdad que para esto si que estoy verde Bueno mirar esto.
formulario.
form action="<?php echo $editFormAction; ?>" name="form1" method="POST">
<p>1
<input name="seleccion[1]" type="checkbox"/>
nombre
<label>
<input name="nombre[1]" type="text" />
</label>
apellidos
<input name="apellidos[1]" type="text" />
</p>
<p>2
<input name="seleccion[2]" type="checkbox" />
nombre
<input name="nombre[2]" type="text"/>
apellidos
<input name="apellidos[2]" type="text" />
</p>
<p>3
<input name="seleccion[3]" type="checkbox" />
nombre
<input name="nombre[3]" type="text" />
apellidos
<input name="apellidos[3]" type="text" />
</p>
<p>
<input type="submit" name="Submit" value="Enviar">
</p>
<input type="hidden" name="MM_insert" value="form1">
</form>
esto seria un formulario si utilizo el dreamweaver pra hacer in insert en la base de datos me sale esto
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO prueba (nombre, apellidos) VALUES (%s, %s)",
GetSQLValueString($_POST['nombre[1]'], "text"),
GetSQLValueString($_POST['apellidos[1]'], "text"));
mysql_select_db($database_con_pb, $con_pb);
$Result1 = mysql_query($insertSQL, $con_pb) or die(mysql_error());
$insertGoTo = "#";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
el problema es que solo me inserta 1 registro el ultimo.
Mi pregunta es en este codigo donde se podria poner el
foreach( $seleccion AS $k => $v) {
mysql_query("INSERT INTO pb_repartos_detalles VALUES( '". $nombre[$k] ."' )");
}
si desues de esto no hay nada, yo ya desisto, tendré que buscar mas soluciones de como poder hacerlo.
muchas gracias por todo. |