Jump to content

Archived

This topic is now archived and is closed to further replies.

markmuir

Validation Check from MySQL database

Recommended Posts


Hi, in serious need of help.

I have a registration form that adds users to a MySQL database. What i'm wanting to do is:>

When you enter the users membership number and then attempt to go to the next field, I want to connect to a MySQL database and check to see if the membership number has been entered and if so, display a pop up box telling me so instead of waiting to type all the information and when I press enter, it tells me then as it can be so time consuming. Can this be done??

Any help at all would be greatly appreciated

Thanks

Share this post


Link to post
Share on other sites
I guess you need some JavaScript routine to dynamically capture and process that input for member number.

Share this post


Link to post
Share on other sites
[quote]
I guess you need some JavaScript
[/quote]

I you could use onBlur() to sumbit the form.  Here's an example of onBlur() in action:

[url=http://www.webreference.com/js/tips/000804.html]http://www.webreference.com/js/tips/000804.html[/url]

Regards
Rich

Share this post


Link to post
Share on other sites
The onBlur function looks as though it could work but is it possible to enter MySql commands within the function?? Or is there any other way I can get it to connect to a mysql database to check to see if the membership number has already been entered after the user has clicked out of the input box?

Share this post


Link to post
Share on other sites
Rather that try and stick sql code into a javascript function you're probably better getting the onBlur() event to just submit the form at the early stage and use the php code that it's calling to verify the data/query the database.

It's likely to be easier that way around.

Regards
Rich

Share this post


Link to post
Share on other sites
Could you tell me how this is done please?? Still in the process of learning

Thanks for your help

Share this post


Link to post
Share on other sites
You need AJAX.

[url=http://www.w3schools.com/ajax/default.asp]http://www.w3schools.com/ajax/default.asp[/url]

after reading that it took me about 30 mins to bang some decent AJAX together. That is what you need my friend. just change the traget urls to the php scripts you wish to use.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.