Jump to content


Photo

Validation Check from MySQL database


  • Please log in to reply
6 replies to this topic

#1 markmuir

markmuir
  • Members
  • Pip
  • Newbie
  • 9 posts

Posted 22 August 2006 - 09:35 AM


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

#2 ronverdonk

ronverdonk
  • Members
  • PipPipPip
  • Advanced Member
  • 277 posts
  • LocationNetherlands

Posted 22 August 2006 - 09:37 AM

I guess you need some JavaScript routine to dynamically capture and process that input for member number.

RTFM is an almost extinct art form, it should be subsidized.

#3 HuggieBear

HuggieBear
  • Members
  • PipPipPip
  • Advanced Member
  • 1,899 posts
  • LocationEngland, UK

Posted 22 August 2006 - 09:50 AM

I guess you need some JavaScript


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

http://www.webrefere...ips/000804.html

Regards
Rich
Advice to MySQL users: Get phpMyAdmin and test your queries work there first, take half the hassle out of diagnosis, also check the reserved words list.

Links: PHP Docs :: RegEx's :: MySQL :: DevGuru :: w3schools

#4 markmuir

markmuir
  • Members
  • Pip
  • Newbie
  • 9 posts

Posted 22 August 2006 - 10:04 AM

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?

#5 HuggieBear

HuggieBear
  • Members
  • PipPipPip
  • Advanced Member
  • 1,899 posts
  • LocationEngland, UK

Posted 22 August 2006 - 10:08 AM

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
Advice to MySQL users: Get phpMyAdmin and test your queries work there first, take half the hassle out of diagnosis, also check the reserved words list.

Links: PHP Docs :: RegEx's :: MySQL :: DevGuru :: w3schools

#6 markmuir

markmuir
  • Members
  • Pip
  • Newbie
  • 9 posts

Posted 22 August 2006 - 10:13 AM

Could you tell me how this is done please?? Still in the process of learning

Thanks for your help

#7 ToonMariner

ToonMariner
  • Members
  • PipPipPip
  • Advanced Member
  • 3,342 posts
  • LocationNewcastle upon Tyne, UK

Posted 22 August 2006 - 10:42 AM

You need AJAX.

http://www.w3schools...jax/default.asp

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.
follow me on twitter @PHPsycho




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users