Form re-population

Hi there



Just wondering if there is a better way of do this?

I have a form that has one of those PHP anti-spam random images. If the user
enters the incorrect

number when they submit they get a error message and have to click back to
re-enter it, the

trouble is when they do all the fields on the form are now blank so they
have to type it all in again.



So I was thinking, when the user submits the form it sets a cookie with all
the forms info,

it runs the tests to make sure the number is correct, if correct then
process the form and deletes the cookie.

If it's not correct when the user clicks back put some code at the bottom of
the form page that tests

that the cookie is set and if there reads the info in and using JavaScript
fills the form in.



This is the only way I can think of, but it there a better way?



Thanks



Brian









------------------------------------------------------------ --------------------

I am using the free version of SPAMfighter for private users.
It has removed 1146 spam emails to date.
Paying users do not have this message in their emails.
Try SPAMfighter for free now!
Brian [ Do, 22 März 2007 01:59 ] [ ID #1665521 ]

Re: Form re-population

Hello,

on 03/21/2007 09:59 PM Brian said the following:
> Just wondering if there is a better way of do this?
>
> I have a form that has one of those PHP anti-spam random images. If the user
> enters the incorrect
>
> number when they submit they get a error message and have to click back to
> re-enter it, the
>
> trouble is when they do all the fields on the form are now blank so they
> have to type it all in again.
>
>
>
> So I was thinking, when the user submits the form it sets a cookie with all
> the forms info,
>
> it runs the tests to make sure the number is correct, if correct then
> process the form and deletes the cookie.
>
> If it's not correct when the user clicks back put some code at the bottom of
> the form page that tests
>
> that the cookie is set and if there reads the info in and using JavaScript
> fills the form in.
>
> This is the only way I can think of, but it there a better way?

Sure. what you need to do is to present and process the form in the same
script.

I use a forms generation and processing class that comes with a plug-in
for CAPTCHA validation, which is the kind of human using validation you
are using.

The forms class takes that approach of using the same script to present
and process the form. Here is a tutorial video explaining the why and
how it works that way:

http://www.phpclasses.org/browse/video/1/package/1/section/u sage.html

The form class is available here:

http://www.phpclasses.org/formgeneration

Here is a live example of the CAPTCHA validation plug-in:

http://www.meta-language.net/forms-examples.html?example=tes t_captcha_input

Here is the same tutorial video section about the CAPTCHA validation
plug-in:

http://www.phpclasses.org/browse/video/1/package/1/section/p lugin-captcha.html

--

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
Manuel Lemos [ Do, 22 März 2007 05:20 ] [ ID #1665524 ]

Re: Form re-population

> Hello,
>
> on 03/21/2007 09:59 PM Brian said the following:
>> Just wondering if there is a better way of do this?
>>
>> I have a form that has one of those PHP anti-spam random images. If the
>> user
>> enters the incorrect
>>
>> number when they submit they get a error message and have to click back
>> to
>> re-enter it, the
>>
>> trouble is when they do all the fields on the form are now blank so they
>> have to type it all in again.
>>
>>
>>
>> So I was thinking, when the user submits the form it sets a cookie with
>> all
>> the forms info,
>>
>> it runs the tests to make sure the number is correct, if correct then
>> process the form and deletes the cookie.
>>
>> If it's not correct when the user clicks back put some code at the bottom
>> of
>> the form page that tests
>>
>> that the cookie is set and if there reads the info in and using
>> JavaScript
>> fills the form in.
>>
>> This is the only way I can think of, but it there a better way?
>
> Sure. what you need to do is to present and process the form in the same
> script.
>
> I use a forms generation and processing class that comes with a plug-in
> for CAPTCHA validation, which is the kind of human using validation you
> are using.
>
> The forms class takes that approach of using the same script to present
> and process the form. Here is a tutorial video explaining the why and
> how it works that way:
>
> http://www.phpclasses.org/browse/video/1/package/1/section/u sage.html
>
> The form class is available here:
>
> http://www.phpclasses.org/formgeneration
>
> Here is a live example of the CAPTCHA validation plug-in:
>
> http://www.meta-language.net/forms-examples.html?example=tes t_captcha_input
>
> Here is the same tutorial video section about the CAPTCHA validation
> plug-in:
>
> http://www.phpclasses.org/browse/video/1/package/1/section/p lugin-captcha.html
>
Hi Manuel

thanks for this, i have had a look and will have a play when i get time,
does look
an easyer way od doing things.

Brian




------------------------------------------------------------ --------------------
I am using the free version of SPAMfighter for private users.
It has removed 1350 spam emails to date.
Paying users do not have this message in their emails.
Try SPAMfighter for free now!
Brian [ Mo, 26 März 2007 02:15 ] [ ID #1669156 ]

Re: Form re-population

Post removed (X-No-Archive: yes)
Notifier Deamon [ Mo, 26 März 2007 19:30 ] [ ID #1669182 ]
PHP » alt.php » Form re-population

Vorheriges Thema: Programmer Wanted. PHP / Apache / MySQL / Linux
Nächstes Thema: PHP software for site of club