Jump to content

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
Link to comment
https://forums.phpfreaks.com/topic/18283-validation-check-from-mysql-database/
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
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?
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
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.
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.