form
Código PHP:
<?php
session_start();
$conexion=@mysql_connect("localhost:3307",$_SESSION[usuario],$_SESSION[clave]) or die ("<font face=arial size=2>Acceso denegado</font>");
mysql_select_db("inventario", $conexion);
$consulta = mysql_query("SELECT ns, articulo, marca, modelo, empresa, ubicacion, sububicacion, observaciones FROM articulos ORDER BY ubicacion", $conexion);
$fila = @mysql_fetch_array($consulta);
echo
"
<font face=Arial size=2>
<center>
<table bgcolor= #C0C0C0>";
while($fila = mysql_fetch_array($consulta))
{
echo "
<form action = modificacionesg.php method = POST>
<tr>
<td><center><input type = text value = '$fila[ns]' name = 'ns2[]'></center></td>
<td><center><input type = text value = '$fila[articulo]' name = 'articulo2[]'><center></td>
<td><center><input type = text value = '$fila[marca]' name = 'marca2[]'><center></td>
<td><center><input type = text value = '$fila[modelo]' name = 'modelo2[]'><center></td>
<td><center><input type = text value = '$fila[empresa]' name = 'empresa2[]'><center></td>
<td><center><input type = text value = '$fila[ubicacion]' name = 'ubicacion2[]'><center></td>
<td><center><input type = text value = '$fila[sububicacion]' name = 'sububicacion2[]'><center></td>
<td><center><input type = text value = '$fila[observaciones]' name = 'observaciones2[]'><center></td>
</tr>";
}
echo
"<td><center><input type = submit value = M></center></td>
</form>
</table>
</body>
</html>";
mysql_close($conexion);
?>
action
Código PHP:
<?php
session_start();
$conexion=@mysql_connect("localhost:3307",$_SESSION[usuario],$_SESSION[clave]) or die ("<font face=arial size=2>Acceso denegado</font>");
mysql_select_db("inventario", $conexion);
foreach($_POST['ns2'] as $k=>$v) {
$resul = @mysql_query("UPDATE articulos SET articulo = '".$_POST[articulo2][$k]."', marca = '".$_POST[marca2][$k]."', modelo = '".$_POST[modelo2][$k]."', empresa = '".$_POST[empresa2][$k]."', ubicacion = '".$_POST[ubicacion2][$k]."', sububicacion = '".$_POST[sububicacion2][$k]."', observaciones = '".$_POST[observaciones2][$k]."' WHERE ns = '$v'",$conexion);
}
Header ("Location: modificacionesf.php");
mysql_close($conexion);
?>