Incomplete form handling

Incomplete form handling

am 02.11.2007 01:18:39 von Animesh Kumar

What is the best method to handle an incomplete form? How to preserve
and display the data that has been already filled?

I know this is classical stuff, but I could not find any great reference
for it yet.

Best,
Animesh

Re: Incomplete form handling

am 02.11.2007 01:25:18 von Shelly

Animesh K wrote:
> What is the best method to handle an incomplete form? How to preserve
> and display the data that has been already filled?
>
> I know this is classical stuff, but I could not find any great
> reference for it yet.
>
> Best,
> Animesh

I collect all the POST data into variables. In the HTML area I have the
values of the fields set to those variables. I also have the form post to
itself and do a header() command to change pages on success.

An example might be a text field "city". In the html area I would have
where $city is
the value of the obtained from the post of that field.

This may not be the best way, but it sure works.

Shelly

Re: Incomplete form handling

am 02.11.2007 01:44:52 von Animesh Kumar

Shelly wrote:

>
> I collect all the POST data into variables. In the HTML area I have the
> values of the fields set to those variables. I also have the form post to
> itself and do a header() command to change pages on success.
>
> An example might be a text field "city". In the html area I would have
> where $city is
> the value of the obtained from the post of that field.
>
> This may not be the best way, but it sure works.
>
> Shelly
>
>


Thanks for the quick response. This method should work, as I expected. I
was wondering if there is a better method :)

Do you post the incomplete data as a hidden post?

Re: Incomplete form handling

am 02.11.2007 02:12:49 von Shelly

Animesh K wrote:
> Shelly wrote:
>
>>
>> I collect all the POST data into variables. In the HTML area I have
>> the values of the fields set to those variables. I also have the
>> form post to itself and do a header() command to change pages on
>> success. An example might be a text field "city". In the html area I
>> would
>> have where
>> $city is the value of the obtained from the post of that field.
>>
>> This may not be the best way, but it sure works.
>>
>> Shelly
>>
>>
>
>
> Thanks for the quick response. This method should work, as I
> expected. I was wondering if there is a better method :)
>
> Do you post the incomplete data as a hidden post?

No, I just post it. I then validate it and process it further. Failing
validation, it drops through and displays. Successful validation send it
off somewhere else when done.

--
Shelly

Re: Incomplete form handling

am 02.11.2007 11:14:23 von shimmyshack

On Nov 2, 12:18 am, Animesh K wrote:
> What is the best method to handle an incomplete form? How to preserve
> and display the data that has been already filled?
>
> I know this is classical stuff, but I could not find any great reference
> for it yet.
>
> Best,
> Animesh

remember to only echo back to the html filtered input, never do
value=""
where $input_value is $_POST['intput_value']

on those required but empty inputs, change their class to cause them
to be highlighted and you're on your way.