...

View Full Version : Query MySQL on Form Field input



keith1995
10-21-2009, 07:06 PM
Not sure if this is a question for the PHP or MySQL forum.

Anyhow, we have a submission form where the user enters details to create a profile of sorts. We only want to allow one profile per email address however our client does not want the user to enter all of their user details and then after submitting the form, get the message that they already have an account with the email address.

Our client has asked us to add the functionality that once an email address is added to the field, that it queries the database at that point to make sure there isn't another account with the same email address.

Our question is what would be involved to add this type of functionality, basically on text input/onchange?

Fumigator
10-21-2009, 07:45 PM
That would be Ajax that you would use, and I would suggest using the jQuery library to do the ajax call. There is actually a jQuery plugin that makes this kind of thing rather simple. In fact there are several plugins, but here's a pretty straight-forward one:

http://plugins.jquery.com/project/smartform

jQuery is awesome! :D

keith1995
10-22-2009, 03:49 PM
Fumigator,

A few questions.

1. Does anything need to be installed on the server (PHP modules, etc) for Ajax and jQuery to work?

2. Do you have any sample code that would accomplish what we are looking for? We would pay for your time to write the sample code if you don't have it already.

Fumigator
10-22-2009, 04:24 PM
Fumigator,

A few questions.

1. Does anything need to be installed on the server (PHP modules, etc) for Ajax and jQuery to work?

2. Do you have any sample code that would accomplish what we are looking for? We would pay for your time to write the sample code if you don't have it already.

#1-- Ajax is a technology that gives you the ability to "sneak" out of a page to grab data or whatever, and "sneak" back in without the page requiring a reload. So there is a server side to the process, but it's no different than a normal server side process-- meaning, you just plop a PHP script out there that is written to handle the Ajax call.

#2-- I know what you mean. I was rather intimidated by Ajax as well as jQuery when I first dove in. But I assure you, the jQuery website has excellent documentation, and lots of examples. I can't say much about the community-- I've never gotten any help from anyone on that worthless google group. Too bad CodingForum's jQuery forum isn't more popular. :thumbsup: But for me to write just an example would be a waste of time, as there are tons of examples and tutorials already written and are just a google away. (Now... if you want to hire me to do some freelance work for you, that's another story... PM me :) )



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum