Re: Ayuda

From: Date: Wed, 23 Jul 2003 13:03:58 +0000
Subject: Re: Ayuda
References: 1  Groups: php.general.es 
Request: Send a blank email to general-es+get-38710@lists.php.net to get a copy of this message
Una forma de hacer lo que querés es poner un <form></form> con tantos hidden como datos tengas, y hacer submit() del form al volver. Para reenviar todo lo que te posteen , podrías usar algo como esto: ?><form action="paginaanterior.php" method="post" name="formulario"> while(list($var,$val)=each($_POST)) { ?><input type="hidden" name="<?php print $var?>" value="<?php print $val ?>"><?php } ?></form> <script Language="Javascript"> document.formulario.submit() </script> <?php Espero que te sirva. ----- Original Message ----- From: "Sergio Valdes" <voig_php@entelchile.net> To: "Lista Php" <lista@phpes.com> Sent: Tuesday, July 22, 2003 7:25 PM Subject: [PHP-ES] Ayuda > Hola necesito una ayuda, estoy creando un pequeño sistema de control, en > una de las páginas solicito el ingreso de fechas y quiero validar esas > fechas cuando envío el formulario y si son inválidas que se devuelva al > formulario anterior para que las cambien. > Un pequeño ejemplo va a continuación: > > Nombre Archivo: agregar1.php > <head> > <title>Agregar Eventos</title> > <meta http-equiv="Content-Type" content="text/html; > charset=ISO-8859-1"> > </head> > <body bgcolor="#f5eab5" text="#00008b"> > <div align=center> > <h2> Agregar un evento de Soporte</h2> > <br></div> > <form method="post" action="agregar2.php"> > > <!-- Definicion de la fecha del evento --> > <pre> Dia<select name="dia_evento" tabindex="1" > > <?php > $fecha=date("m/j/Y"); > for ($dias_ev=1; $dias_ev<=31; $dias_ev++){ > echo '<option>' .$dias_ev; > } > ?> > </select> Mes<select name="mes_evento" tabindex="2" > > <?php > for ($mes_ev=1; $mes_ev<=12; $mes_ev++){ > echo '<option>' .$mes_ev; > } > ?> > </select> Año<select name="año_evento" tabindex="3" > > <?php > for ($año_ev=2003; $año_ev<=2012; $año_ev++){ > echo '<option>' .$año_ev; > } > . > . > .Continua > . > . > ?> > <!-- Botones de Actualizacion y borrado del formulario --> > <pre> <input type="submit" name="sub_agregar1" > value="Agregar" > size="10" alt="ppp" tabindex="13" <input > type="reset" name="borrar" > value="Borrar" size=10 tabindex="14"> > </pre> > </form> > </body> > </html> > > > Nombre Archivo: agregar2.php > <head> > <title>Agregar Eventos</title> > <meta http-equiv="Content-Type" content="text/html; > charset=ISO-8859-1"> > </head> > <!-- <body bgcolor="#eaeda5" text="#00008b"> --> > <body bgcolor="#f5eab5" text="#00008b"> > <div align=center> > <h2> Agregar un evento de Soporte</h2> > </div> > <?php > // Inicializacion de variables > $dia_ev=""; > $mes_ev=""; > $año_ev=""; > $sede=""; > $tipo_ev=""; > $tecnico=""; > $evento=""; > $estado=""; > $dia_sol=""; > $mes_sol=""; > $año_sol=""; > $solucion=""; > $val=0; > > // Traspaso de variables desde formulario > $dia_ev=$_POST['dia_evento']; > $mes_ev=$_POST['mes_evento']; > $año_ev=$_POST['año_evento']; > $fecha_ev=$mes_ev."/".$dia_ev."/".$año_ev; > $sede_ev=$_POST['sede_ev']; > $tipo_ev=$_POST['tipo_evento']; > $tecnico=$_POST['tecnico']; > $evento=$_POST['evento']; > $estado=$_POST['estado']; > $dia_sol=$_POST['dia_soluc']; > $mes_sol=$_POST['mes_soluc']; > $año_sol=$_POST['año_soluc']; > $fecha_sol=$mes_sol."/".$dia_sol."/".$año_sol; > $solucion=$_POST['solucion']; > > file://Validacion fecha del evento > $val=checkdate($mes_ev, $dia_ev, $año_ev); > if ($val<>1) { > echo "<SCRIPT language='JavaScript1.3'>"; > echo "alert(¡Atención: Fecha del Evento erronea. Cambiela!)"; > echo "</SCRIPT>"; > } > > file://Validacion de fecha de solucion > $val=checkdate($mes_sol, $dia_sol , $año_sol); > if ($val<>1) { > echo "<SCRIPT language='JavaScript1.3'>"; > echo "alert(¡Atención: Fecha de Solución erronea. Cambiela!)"; > echo "</SCRIPT>"; > } > . > . > .continua ..... > . > . > ?> > > > Obviamente no está todo el código, pero lo que necesito es que despues > que se despliegue el mensaje de Error, vuelva a la pagina agregar1.php, > pero sin perder los datos que se digitaron, tal como ocurre con el botón > "Atras" del navegador de internet. > > Espero que me puedan ayudar > > > Sergio Valdés H. > > > --------------------------------------------------------------------- > Archivo On-line: http://www.phpes.com/ > via news: news://news.phpes.com/ > Manual PHP en español: http://www.php.net/manual/es/ > Para dar de baja la suscripción, mande un mensaje a: > lista-unsubscribe@phpes.com > --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.500 / Virus Database: 298 - Release Date: 10/07/03

« previous php.general.es (#38710) next »