Incomplete form handling

This is a discussion on Incomplete form handling within the PHP Language forums, part of the PHP Programming Forums category; What is the best method to handle an incomplete form? How to preserve and display the data that has been ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 11-02-2007
Animesh K
 
Posts: n/a
Default Incomplete form handling

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
Reply With Quote
  #2 (permalink)  
Old 11-02-2007
Shelly
 
Posts: n/a
Default Re: Incomplete form handling

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
<input type="text" name="city" value="<?php echo $city; ?>"> 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


Reply With Quote
  #3 (permalink)  
Old 11-02-2007
Animesh K
 
Posts: n/a
Default Re: Incomplete form handling

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
> <input type="text" name="city" value="<?php echo $city; ?>"> 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?
Reply With Quote
  #4 (permalink)  
Old 11-02-2007
Shelly
 
Posts: n/a
Default Re: Incomplete form handling

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 <input type="text" name="city" value="<?php echo $city; ?>"> 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


Reply With Quote
  #5 (permalink)  
Old 11-02-2007
shimmyshack
 
Posts: n/a
Default Re: Incomplete form handling

On Nov 2, 12:18 am, Animesh K <animesh1...@gmail.com> 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="<?php echo $input_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.

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 09:30 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0