Re: Form Design Advice
От | |
---|---|
Тема | Re: Form Design Advice |
Дата | |
Msg-id | 20050302195528.43714.qmail@web52404.mail.yahoo.com обсуждение исходный текст |
Ответ на | Re: Form Design Advice ("Ross Gohlke" <ross@grinz.com>) |
Ответы |
Re: Form Design Advice
|
Список | pgsql-novice |
--- Ross Gohlke <ross@grinz.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/
В списке pgsql-novice по дате отправления: