473,396 Members | 1,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

form processing question

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 hotmail.com)

My question is:

1). How can I send the text entered in the text box to a server side PHP
script?
2). How do I receive the response (simple true or false) from the server
side, back in the form?
Jun 2 '08 #1
2 1224
*** Ronald Raygun escribió/wrote (Fri, 09 May 2008 17:07:41 +0100):
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 hotmail.com)

My question is:

1). How can I send the text entered in the text box to a server side PHP
script?
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...

http://mootools.net/
http://www.prototypejs.org/

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

http://www.quirksmode.org/js/xmlhttp.html

--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor en cubitos: http://www.demogracia.com
--
Jun 2 '08 #2
Hello,

on 05/09/2008 01:07 PM Ronald Raygun said the following:
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 hotmail.com)

My question is:

1). How can I send the text entered in the text box to a server side PHP
script?
2). How do I receive the response (simple true or false) from the server
side, back in the form?
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.

http://www.phpclasses.org/formsgeneration

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

http://www.meta-language.net/forms-e...test_ajax_form

You may also want to watch this tutorial video:

http://www.phpclasses.org/browse/vid...ugin-ajax.html
--

Regards,
Manuel Lemos

PHP professionals looking for PHP jobs
http://www.phpclasses.org/professionals/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
Jun 2 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Danny Anderson | last post by:
Hola, PHP folk! I have a php page that contains a self-processing form. The form holds search results. The search terms originally came from the previous page, but the user can repeatedly...
5
by: Jack | last post by:
I'm setting up a form and want to check if some conditions are met when the form submits. If they aren't, the form displays a missing field message and the user has to go back to fill in the...
5
by: WmGill | last post by:
I am experimenting with Python, and want to convert some of my PHP scripts to python cgi scripts. In PHP I use PHP_SELF for the action target. This way I can "reuse" data in fields (i.e. if the...
1
by: Adam Smith | last post by:
Have a lot of data to collect / choices presented, producing a large form. I am desirous of breaking it up into multiple pages to avoid detracting users. Could some one say how best to create...
8
by: Raed Sawalha | last post by:
I have form with progress bar ,when application begin processing and progress bar moving if I minimized the form and try to restore it ,it is not showing until the processing completed ,how can I...
13
by: Ioannis Vranos | last post by:
Why in this code the form *does not refresh* when it gets the focus/after some time? #using <mscorlib.dll> #using <system.windows.forms.dll> #using <system.dll> #using <system.drawing.dll>
9
by: eswanson | last post by:
I have a web page I need to post a file plus some other fields to it. How can I do this from a asp.net page. I know I can send individual fields to the other page, but how do I send a file to the...
7
by: gerryLowry::Ability Business Computer Services {KC | last post by:
"Getting Back Your Visual Basic 6.0 Goodies" by Billy Hollis, 2003-5-14, states: "Getting a Forms Collection Visual Basic 6.0 developers are often fond of looping through the currently loaded...
27
by: Chris | last post by:
Hi, I have a form for uploading documents and inserting the data into a mysql db. I would like to validate the form. I have tried a couple of Javascript form validation functions, but it...
22
by: Zytan | last post by:
I have public methods in a form. The main form calls them, to update that form's display. This form is like a real-time view of data that is changing. But, the form may not exist (it is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.