![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
30/11/2013, 11:57
|
| | Fecha de Ingreso: noviembre-2013
Mensajes: 6
Antigüedad: 11 años, 2 meses Puntos: 0 | |
Respuesta: Almacenar variables en array desde formulario No había puesto el código porque lo he cambiado muchas veces tratando de probar cosas distintas. Pero bueno esto es lo último que he intentado.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
</head>
<body>
<center>
<?php
if (isset($_POST['producto']) && isset($_POST['referencia'])) {
$miarray = array("Producto" => $_POST['producto'], "Referencia" => $_POST['referencia']);
}
foreach ($miarray as $clave => $valor) {
echo $clave . " " . $valor['producto'];
}
?>
<form name="formulario" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
Producto:<input type="text" name="producto"/>
Referencia:<input type="text" name="referencia"/><br/>
<input type="submit" value="Insertar"/>
</form>
</center>
</body>
</html> |