Arregle el formulario, pero me esta guardando solo la fecha y la Institución, lo demás no lo guarda, anexo el codigo para que me puedas hacer el favor de revisarlo, ya que necesito X(5,10,15 registros) datos en pedidos
Código PHP:
Ver original
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { foreach($_POST['cod_ips'] as $key => $val){ $insertSQL = sprintf("INSERT INTO pedidos (cod_ips, fecha_solicitud, suministro, presentacion, casa_productora, cantidad) VALUES (%s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['inst'][$key], "int"), GetSQLValueString($_POST['fecha_solicitud'][$key], "text"), GetSQLValueString($_POST['suministro'][$key], "text"), GetSQLValueString($_POST['presentacion'][$key], "text"), GetSQLValueString($_POST['casa'][$key], "text"), GetSQLValueString($_POST['cantidad'][$key], "text")); mysql_select_db($TU_BASEDEDATOS, $TU_CONEXION); $Result1 = mysql_query($insertSQL, $TU_CONEXION) or die(mysql_error()); } } ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>****</title> <script> function agregaFila( id ) { var tabla = document.getElementById( id ); var tbody = document.getElementById( tabla.id ).tBodies[0]; var row = tbody.rows[0] .cloneNode( true ); var id = 1; while( document.getElementById( tabla.id+'_fila_'+id ) ) { id++; } if (id<=21){ row.id = tabla.id+'_fila_'+id; row.style.display = ''; tbody.appendChild( row ); } } function borraFila( fila ) { var id = fila.id; if( fila.parentNode.rows.length <= 2 ) return; document.getElementById( id ).parentNode.removeChild( document.getElementById(id) ); } </script> <style type="text/css"> <!-- .Estilo1 { font-size: 80%; color: #006699; font-weight: bold; } .Estilo2 {color: #000000} .Estilo6 {color: #0066FF} --> </style> </head> <body class="twoColFixLtHdr"> <p> </p> <p> </p> <form id="form1" name="form1" method="POST" action="<?php echo $editFormAction; ?>"> <table width="223" border="0" align="center"> <tr> <td width="152"><fieldset> <legend class="Estilo1 Estilo2">Fecha</legend> <label> <input name="fecha_solicitud[]" type="text" id="fecha_solicitud" size="12"/> </label> <input name="fecha_solicitud[]" type="hidden" id="fecha_solicitud" value="<?php echo $fecha_solicitud?>" /> </fieldset> </td> <td width="32"> </td> <td width="8"> </td> <td width="13"> </td> </tr> </table> <table width="612" border="0"> <tr> <td width="154"><fieldset> <legend class="Estilo1 Estilo2">Departamento</legend> - //[B]no son necesarios[/B] <label> <input name="departamento" type="text" id="departamento" size="15" /> - //[B]no son necesarios[/B] </label> </fieldset></td> <td width="10"> </td> <td width="15"> </td> <td width="156"><fieldset> <legend class="Estilo1 Estilo2">Ciudad</legend> - //[B]no son necesarios[/B] <label> <input name="ciudad" type="text" id="ciudad" size="15" /> - //[B]no son necesarios[/B] </label> </fieldset></td> <td width="8"> </td> <td width="15"> </td> <td width="212"><fieldset> <legend class="Estilo1 Estilo2">Institución</legend> <label> <input type="text" name="inst[]" id="inst" /> </label> <input name="cod_ips[]" type="hidden" id="cod_ips" value="<?php echo $inst?>" /> </fieldset></td> <td width="15"> </td> </tr> </table> <p> </p> <table id="tabla_1" align="center"> <thead> <tr valign="baseline"> <td align="center" class="Estilo1 Estilo2">Biologico</td> <td align="center" class="Estilo1 Estilo2">Presentación</td> <td align="center" class="Estilo1 Estilo2">Casa Productora</td> <td align="center" class="Estilo1 Estilo2">Cantidad</td> <td></td> </tr> </thead> <tbody> <tr id="clonable" style="display:none"> <td><label> <select name="suministro[]" id="suministro" value=""> <option>Seleccionar</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> </select> <input name="suministro[]" type="hidden" id="suministro" value="<?php echo $suministro?>" /> </label></td> <td><input name="presentacion[]" type="text" id="presentacion" size="20" /> <input name="presentacion[]" type="hidden" id="presentacion" value="<?php echo $presentacion?>" /></td> <td><input name="casa[]" type="text" id="casa" size="15" /> <input name="casa_productora[]" type="hidden" id="casa_productora" value="<?php echo $casa?>" /></td> <td><input name="cantidad1[]" type="text" id="cantidad1[]" value="" size="10" /> <input name="cantidad[]" type="hidden" id="cantidad" value="<?php echo $cantidad1?>" /></td> <td><a href="#" class="Estilo6" onclick="borraFila(this.parentNode.parentNode)">Eliminar</a></td> </tr> </tbody> <tr valign="baseline"> <td nowrap="nowrap" align="center"><a href="javascript:agregaFila( 'tabla_1' );" class="Estilo6">Añadir</a></td> <td colspan="4" align="center"><input type="submit" value="Insertar registro" /></td> </tr> </table> <p> </p> <input type="hidden" name="MM_insert" value="form1" /> </form> </body> </html>
Te agradesco mucho.