Re: add/edit combo form--opinions wanted

From: Xenophobe (xenophobe_at_planetx.com)
Date: 07/13/04


Date: Tue, 13 Jul 2004 14:53:08 GMT

True, but the forms (there are several, depending on the category of
information being entered) is quite lengthy and--for ease of development &
maintenance--was hoping to use one form for each.

That said, I will probably go ahead and use separate forms for each
(add/edit) and hope the client isn't change order happy.

"Tony Marston" <tony@NOSPAM.demon.co.uk> wrote in message
news:cd0ad3$gj4$1$8300dec7@news.demon.co.uk...
>
> "Xenophobe" <xenophobe@planetx.com> wrote in message
> news:XwCIc.62699$MB3.53701@attbi_s04...
> > I would like to use the same form for adding new records and editing
> > existing records. New form values are contained in $_POST. Database
values
> > are contained in an associated array. It seems to me that in order to
use
> > the same form for both tasks, I need to assign the form field values to
> page
> > variables. The flow might look something like this:
> >
> > if $_POST
> >
> > $variable1 = $_POST['field1'];
> > $variable2 = $_POST['field2'];
> >
> > else if $rows
> >
> > $variable1 = $row['field1'];
> > $variable2 = $row['field2'];
> >
> > end if
> >
> > Can someone suggest a simplier way to do this?
>
> The simple way is to not use the same form for both operations. If you use
> separate scripts for input and amend you don't have to work out whether
the
> user's input is for a INSERT or an UPDATE. This is what the KISS principle
> is all about.
>
> --
> Tony Marston
>
> http://www.tonymarston.net
>
>
>