Re: Passing values back to form
| From: | Kevin Stone | Date: | Thu, 05 Jun 2003 17:37:51 +0000 |
| Subject: | Re: Passing values back to form | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-150379@lists.php.net to get a copy of this message | ||
Hi Daniel,
My advice is to use php sessions. You can register both the filled and
empty values in the session after processing them. Then you can header()
redirect normally with no fuss and extract the values from the session file
on the form page.
And here's a tip. Set up some CSS in a switch() statement to highlight the
form fields that are left blank. This makes for a nice user interface,
esspecially on larger forms.
Read up on sessions..
http://www.php.net/manual/en/ref.session.php
HTH,
Kevin Stone
----- Original Message -----
From: "Daniel J. Rychlik" <drychlik@tcsconsult.com>
To: <php-general@lists.php.net>
Sent: Thursday, June 05, 2003 10:31 AM
Subject: [PHP] Passing values back to form
Im new to PHP coming from a background in perl devlopement. I have a form
that a user can fill out.
On submit the values are iterated over a foreach to check for empty(). If
the an emtyp $key is found then it passes an error string to my error
function.
I have 2 php files, one that is the Form called profile.php and one that
processes the values from the form, called profileprocess.php. There are
multiple functions in profileprocess.php. When the header function is
called in the profileprocess.php it takes you back to the profile.php with
empty values in the fields. I was wandering if their is a way, (which Im
sure their is) to pass back all the data that was correctly entered back to
the form, and then a nice little message that displays the error of the data
that needs to be checked by the user. I could do this a number of ways, but
the key is not writing code that you dont have to. Its just smarter
programming.
Any ideas, or functions I could read on in the rtFM manual is greatly
appreciated.
I appreciate you looking at this problem...
Thanks in advance,
Daniel