From: | <operationsengineer1(at)yahoo(dot)com> |
---|---|
To: | ross(at)grinz(dot)com, pgsql-novice(at)postgresql(dot)org |
Subject: | Re: Form Design Advice |
Date: | 2005-03-02 19:55:28 |
Message-ID: | 20050302195528.43714.qmail@web52404.mail.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
--- Ross Gohlke <ross(at)grinz(dot)com> wrote:
> Overhead is not really the issue.
>
> The real question is how to reuse the same
> page/script.
> Let's say your script is form.php, accessed at
> www.mydomain.org/form.php
>
> Your POST has to point to itself
> <form method="post" action="form.php">
>
> Set up a check system with two different states:
> check, process; the
> default is check
> <input type="hidden" name="action" value="check">
>
> LOGIC
> If action = check (always the case when form is
> submitted)
> do error checking
> if errors
> display error messages
> else action = process
> if action = process
> $x = 0
> foreach ($form as $key => $val)
> $field[$x] = $val[$x]
> $x++
> insert into table set $field[0] = $val[0],
> $field[1] = $val[0]...
> foreach ($form as $key => $val)
> echo $key : $val // display results
> display form
> Use the form field names to construct form values as
> an array
> <input type="text" name="form[$fieldname]"
> value="">
>
> The form is always displayed. Error messages and
> results both appear above
> the form. Nothing is inserted until there are no
> errors.
>
> Use PHP to validate the input.
ross, i have the logic and error checking (for both
form entry and db process) down. i'm just wondering
if it is worth displaying the entry for a quick user
visual check - not in the form, but above the form.
for large forms, though, this takes a lot of overhead,
although, my sessions approach could be eliminated to
reduce lots of coding.
you struck on something that may be even more
important to me. you seem to have a function that
iterates through the form elements.
this method seems to work nicely, although i don't
know enough to decide if it will work for me. i'm
using manuel lemos' forms class from phpclasses.org.
http://www.phpclasses.org/browse/package/1.html
do you have a link to a tutorial that explains this
approach in more depth? i'll do some web searches now
to see what i can come up with and i'll report back.
__________________________________
Celebrate Yahoo!'s 10th Birthday!
Yahoo! Netrospective: 100 Moments of the Web
http://birthday.yahoo.com/netrospective/
From | Date | Subject | |
---|---|---|---|
Next Message | Daniel Blavos | 2005-03-03 00:23:45 | Blasted Errors on everything. |
Previous Message | Christian Hofmann | 2005-03-02 18:44:41 | User right management concerning functions |