Re: Form Question

From: Date: Mon, 22 Oct 2001 22:02:19 +0000
Subject: Re: Form Question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-71871@lists.php.net to get a copy of this message
Chip, I read all of the posts regarding this topic that I could find, and just *had* to reply. (Take the TIME to look at this. It is about the most Efficient, Powerful way I know of) Do this! __________________________________________________ <?php //If the hidden variable ACTION == DOIT then process the form //This way, the form will not get processed the first time around... if($ACTION=='DOIT') {
      //Validate Form Here
      if(empty($txtNAME)) $oErr->txtNAME="Required";
      if(empty($txtADDRESS)) $oErr->txtADDRESS="Required";
      //if there is an error message, break out here
      if(isset($oErr)) break;
      //Save your form here...
      //All went ok...  Redirect to the next page...
      header("Location: nextpage.php");
      exit;
} ?> <form name="frmMyForm" method="post" action="<?php echo $PHP_SELF; ?>"> <input type="hidden" name="ACTION" value="DOIT"> <?php echo($oErr->txtNAME); ?> <input type="text" name="txtNAME" value="<?php echo(htmlspecialchars($txtNAME)); ?>">
    *or*
<?php1 if(isset($oErr->txtADDRESS)) echo($oErr->txtADDRESS); ?> <input type="text" name="txtADDRESS" value="<?php echo(htmlspecialchars($txtADDRESS)); ?>"> </form> ____________________________________________________________ -Jason Garber At 03:49 PM 10/21/2001 -0400, Chip Landwehr wrote:
I got a form that a user fills out. When they hit submit they are transfered to a PHP page that verifies their data. If a problem is found (They forgot to enter an e-mail address) the PHP sends them back to the original form with the field they forgot to fill out highlighted in red. Unfortunately all there entries are wiped out and they have to re-enter everything. Any easy way to keep there original entries? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net


« previous php.general (#71871) next »