A simple example with one field:

  if (isset($submit))
    // do fields checking here...
    if (empty($fname))
      $errmsg = "Name not entered please fill it in!";
      // proceed here....

<? if (isset($errmsg)) { ?>
<font color="red"><?=$errmsg?></font>
<? } ?>
*Name: <input type="text" name="fname" value="<?=isset($fname) ? $fname :
<input type="submit" name="submit">

"Michael Conley" <[EMAIL PROTECTED]> wrote in message
> I have a form that requires a user to enter various information (name,
> address, phone number, etc...).  When they submit this form, the next PHP
> page checks to make sure that the required fields were filled in.  What I
> would like to do is check to see if the required fields are all filled in
> and if they are not, save the values they submitted and go back to the
> original page, display a message that says the fields that need to be
> in and populate the rest of the fields with the information the user
> orignally submitted.  This will keep them from having to type in all of
> information again.
> I can run the checks just fine to see if the required fields are all
> in.  I then save the data from all the fields into variables.  What I
> like to do is automatically forward the user back to the original page
> the values (i already have all of the fields set with
> "value="$variablename"" to allow them to get the data that is sent back).
> The only way I have been able to get this to work is to set this up as a
> regular form with hidden HTML fields and a Submit button.  I really want
> this to be an automatic process.  Any thoughts on how to accomplish this?
> When I set up a "Header", the user is forwarded back to the page that I
> want, but none of the variables go with them (they are set by simply
> something like "$savedlastname = $lastname, where $lastname is the HTML
> variable from the original form).
> Any help is appreciated.

PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to