|
Posted by Tom on 03/26/07 17:30
On Mon, 26 Mar 2007 00:15:42 GMT, Brian wrote...
>
>> 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/usage.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=test_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/plugin-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
>
>
>
If you use the same PHP file to display the initial empty form and handle error
messages, you can pre-fill in the form fields with the appropriate $_POST or
$_GET variables. There's probably some good introductory PHP books that would
cover that in greater and better detail.
Tom
--
Newsguy.com - Basic Accounts $39.95 / 12 months
Navigation:
[Reply to this message]
|