RE: [PHP] How to make a form retain its info
| From: | Matt McClanahan | Date: | Thu, 27 Jul 2000 20:16:22 +0000 |
| Subject: | RE: [PHP] How to make a form retain its info | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-8652@lists.php.net to get a copy of this message | ||
On Thu, 27 Jul 2000, Craig Vincent wrote:
> > Interesting.. What do you trigger on to decide wether to
> > "pre-load" the form?
> > Or do you check each field, and fill or not depending on wether something
> > was there?
> >
> > I like the idea of flagging the errored field, but this script
> > seems to be
> > getting fat pretty quickly.
> > You'd have to pass back something to point to the errored field(s)..
> >
> > Do you have a template for this?
>
> Not really...all my forms have this feature and it works quite well :)
Since we're all tossing out examples of how to do this... :)
My project at work recently has involved a huge amount of forms for a
content management system. As a result, I came up with a two-file system
for doing any form I needed. The gist of it is that one page displays the
html form and reports errors, the other page is the form action, which
decides if an error exists, and processes the form once all errors are
delt with. The approach has proven to be quite scalable, I've used the
layout for everything in the management system. Account DB's, scheduling
events, managing photo galleries.. About the only thing I've found so far
that doesn't really fit the layout is when something needs to involve many
stages. (The classic InstallShield 'enter data, click next, enter data,
click next, enter data....' approach) But I don't like that approach
anyway, and it's cumbersome to do with web forms, imho.
Anyway, have a look. At the very least it'll add to the ideas that have
been brought up.
http://mmcc.cx/php/
I've documented them a bit and thrown in some other small comments which
may or may not be useful. :)
Matt