Ver Mensaje Individual
  #2 (permalink)  
Antiguo 13/03/2013, 04:29
Avatar de IsaBelM
IsaBelM
Colaborador
 
Fecha de Ingreso: junio-2008
Mensajes: 5.032
Antigüedad: 15 años, 10 meses
Puntos: 1012
Respuesta: Recoger variables desde un formulario dinamco

este es un problema que está relacionado con php, no con javascript

frm.php
Cita:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta name="http-equiv" content="Content-type: text/html; charset=UTF-8"/>
</head>
<body>
<form action="frm.php" method="post">
<input type="text" name="campos[]" value="valor1" />
<input type="text" name="campos[]" value="valor2" />
<input type="text" name="campos[]" value="valor3" />
<br />
<input type="submit" value="Enviar" />
</form>
<?php
$valores = array($_POST['campos']); // matriz con todos los valores de los campos


if(sizeof($valores[0]) != 0) {

foreach($valores[0] as $key => $valor) {
$fields[] = $key;
$values[] = $valor;
}

echo "Esta es la información recibida<br /><br />";
echo "+ CAMPOS " .implode(',', $fields). " VALORES " .implode(',', $values);

}
?>
</body>
</html>
no importa si los controles se crean dinámicamente o no
__________________
if(ViolenciaDeGénero) {alert('MUJER ASESINADA');}