form processing question

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I have a form, which contains a textfield for a user to enter their
username. I want to provide a button that allows the user to check to
see whether that username has already been taken up by someone else (a
bit like the functionality available when signing up for

My question is:

1). How can I send the text entered in the text box to a server side PHP
2). How do I receive the response (simple true or false) from the server
side, back in the form?

Re: form processing question

*** Ronald Raygun escribió/wrote (Fri, 09 May 2008 17:07:41 +0100):
Quoted text here. Click to load it

Hitting "Enter" ;-? But I presume you mean without reloading the current
page. That's what they call AJAX. You need JavaScript to do it so it's
beyond the scope of PHP, but it should not be too difficult if you get some
pre-built code out there. You can either use a framework with AJAX
abilities... / /

... or write the code yourself; in the latter, this can help:

-- - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web:
-- Mi web de humor en cubitos:

Re: form processing question


on 05/09/2008 01:07 PM Ronald Raygun said the following:
Quoted text here. Click to load it

You may want to take a look at this form class. It lets you submit the
form without page reloading using AJAX. You can connect the textfield
ONCHANGE event to the AJAX form submission.

That makes it execute the same script that generated the form, except
that your script will be able to tell whether the form is being
submitted via AJAX so you can check the user name. In response, you can
update any parts of the page to tell the user whether the name is taken.

I don't have an example script to do exactly that, but there is one
example script to submit the form via AJAX here:

You may also want to watch this tutorial video:


Manuel Lemos

PHP professionals looking for PHP jobs /

PHP Classes - Free ready to use OOP components written in PHP /

Site Timeline