Re: Form Design Advice
От | Ross Gohlke |
---|---|
Тема | Re: Form Design Advice |
Дата | |
Msg-id | 50257.4.62.156.229.1109767040.squirrel@4.62.156.229 обсуждение исходный текст |
Ответ на | Form Design Advice (<operationsengineer1@yahoo.com>) |
Ответы |
Re: Form Design Advice
(<operationsengineer1@yahoo.com>)
|
Список | pgsql-novice |
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. > 1. display blank form > 2. perform insert after data is submitted (assuming no > errors which i check for) > 3. perform select to get data entered > 4. save data in global session array > 5. redisplay the empty form (ready for new input) with > the printed session array components (representing > what was entered) above the form followed by " > successfully entered." > > now that i've moved beyond filling in one column in > one table, this seems to be an overhead hog - > especially when multiple columns are entered into > multiple tables. > > it's design decision time... am i being to picky by > wanting to display the data without adding any extra > button clicks? > > does anybody have a "cool green" way of getting this > done? > > i'm thinking i can just do the data entry (and avoid > the extra selects and session work) and include a > button to include a user input variable number of most > recent entries. > > tia... > > > > __________________________________ > Do you Yahoo!? > Take Yahoo! Mail with you! Get it on your mobile phone. > http://mobile.yahoo.com/maildemo > > ---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives? > > http://archives.postgresql.org -- Ross Gohlke <-> http://GRINZ.com P> 901.276.9750 (Memphis) / 310.356.6906 (Los Angeles) FAX/HOTLINE> 877.806.0861 99 S. 2nd St. #A-161 Memphis, TN 38103 | interactive zen |
В списке pgsql-novice по дате отправления: