if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
foreach($_POST["cod_ips"] as $key => $value){
$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_ultimo'][$key], "text"),
GetSQLValueString($_POST['presentacion_ultimo'][$key], "text"),
GetSQLValueString($_POST['casa_ultimo'][$key], "text"),
GetSQLValueString($_POST['cantidad_ultimo'][$key], "text"));
mysql_select_db($TU_DATABASE, $TU_CONEXION);
$Result1 = mysql_query($insertSQL, $TU_DATABASE) 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>nada</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>
</fieldset> </td>
<td width="32"> </td>
<td width="8"> </td>
<td width="13"> </td>
</tr>
</table>
<table width="612" border="0">
<tr>
<td width="212"><fieldset>
<legend class="Estilo1 Estilo2">Institución</legend>
<label>
<input type="text" name="inst[]" id="inst[]" />
</label>
</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_ultimo[]" id="suministro_ultimo[]">
<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>
</label></td>
<td><input name="presentacion_ultimo[]" type="text" id="presentacion_ultimo[]" size="20" /></td>
<td><input name="casa_ultimo[]" type="text" id="casa_ultimo[]" size="15" /></td>
<td><input name="cantidad_ultimo[]" type="text" id="cantidad_ultimo[]" value="" size="10" /></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>