Ver Mensaje Individual
  #8 (permalink)  
Antiguo 30/11/2013, 11:57
kensi
 
Fecha de Ingreso: noviembre-2013
Mensajes: 6
Antigüedad: 10 años, 5 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>