PHP & AJAX Form Validation

PHP & AJAX Form Validation

am 03.11.2007 18:33:49 von Angela

Hello

Looking for a simple script example for PHP validation on form with AJAX.

Yes, I've google this many times over and there are a lot of different
AJAX frameworks to work with.

Simple form where values/input is validated by a PHP script.

Thanks greatly

Re: PHP & AJAX Form Validation

am 03.11.2007 19:11:44 von Jerry Stuckle

Angela wrote:
> Hello
>
> Looking for a simple script example for PHP validation on form with AJAX.
>
> Yes, I've google this many times over and there are a lot of different
> AJAX frameworks to work with.
>
> Simple form where values/input is validated by a PHP script.
>
> Thanks greatly
>

Never depend on client-side anything for validation.

You can use javascript to validate client-side, but when the user
submits the data, you *must* validate it server-side to be safe.

AJAX has nothing to do with the latter. It's just standard PHP
validation techniques.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Re: PHP & AJAX Form Validation

am 03.11.2007 20:18:30 von unknown

Post removed (X-No-Archive: yes)

Re: PHP & AJAX Form Validation

am 04.11.2007 02:41:13 von Angela

That's extactly what I am wanting to do.

Use Javascript/AJAX to display the error messages for user
and use PHP (server side) to do the validation (regex, check db, etc).

Purpose of looking at AJAX is because this is all done in 'real time'
(asonychronous)

Anyone with any simple examples?

:)

Tom wrote:
> On Sat, 03 Nov 2007 13:11:44 -0500, Jerry Stuckle wrote...
>> Angela wrote:
>>> Hello
>>>
>>> Looking for a simple script example for PHP validation on form with AJAX.
>>>
>>> Yes, I've google this many times over and there are a lot of different
>>> AJAX frameworks to work with.
>>>
>>> Simple form where values/input is validated by a PHP script.
>>>
>>> Thanks greatly
>>>
>> Never depend on client-side anything for validation.
>>
>> You can use javascript to validate client-side, but when the user
>> submits the data, you *must* validate it server-side to be safe.
>>
>> AJAX has nothing to do with the latter. It's just standard PHP
>> validation techniques.
>>
>
> You could use AJAX to display interactive messages and validate some of the
> data, but like Jerry mentioned, it is unreliable. Use your PHP to validate the
> information at the server whether or not you use AJAX to manage the data on the
> client side.
>
> Tom

Re: PHP & AJAX Form Validation

am 04.11.2007 03:49:02 von Jerry Stuckle

Angela wrote:
> That's extactly what I am wanting to do.
>
> Use Javascript/AJAX to display the error messages for user
> and use PHP (server side) to do the validation (regex, check db, etc).
>
> Purpose of looking at AJAX is because this is all done in 'real time'
> (asonychronous)
>
> Anyone with any simple examples?
>
> :)
>
> Tom wrote:
>> On Sat, 03 Nov 2007 13:11:44 -0500, Jerry Stuckle wrote...
>>> Angela wrote:
>>>> Hello
>>>>
>>>> Looking for a simple script example for PHP validation on form with
>>>> AJAX.
>>>>
>>>> Yes, I've google this many times over and there are a lot of
>>>> different AJAX frameworks to work with.
>>>>
>>>> Simple form where values/input is validated by a PHP script.
>>>>
>>>> Thanks greatly
>>>>
>>> Never depend on client-side anything for validation.
>>>
>>> You can use javascript to validate client-side, but when the user
>>> submits the data, you *must* validate it server-side to be safe.
>>>
>>> AJAX has nothing to do with the latter. It's just standard PHP
>>> validation techniques.
>>>
>>
>> You could use AJAX to display interactive messages and validate some
>> of the
>> data, but like Jerry mentioned, it is unreliable. Use your PHP to
>> validate the
>> information at the server whether or not you use AJAX to manage the
>> data on the
>> client side.
>>
>> Tom
>

And what happens when people have javascript disabled?

Javascript should be used to *enhance* the experience, not be *required*
by the experience.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Re: PHP & AJAX Form Validation

am 04.11.2007 09:25:32 von Michael Fesser

..oO(Angela)

>That's extactly what I am wanting to do.
>
>Use Javascript/AJAX to display the error messages for user
>and use PHP (server side) to do the validation (regex, check db, etc).

JS is optional and not always available. Do you want such a critical
thing like error messages just be an "optional feature"?

>Purpose of looking at AJAX is because this is all done in 'real time'
>(asonychronous)
>
>Anyone with any simple examples?

Why not start simple with the most typical and most reliable way of
validating the form data on the server and displaying the form it again
with inline error messages if something was wrong?

_After_ that is working properly, you _could_ add some client-side stuff
to pre-validate fields before the form is submitted. This doesn't have
to be done with "AJAX" - plain JS is enough in many cases.

Micha