post #1 of 1
Thread Starter 
Hey Guys

I am currently trying to build a website for a guild that someone has asked me to do for them. I am currently in the account creation page of the site. I have managed to get the form to upload data to the site, it all works dandy! However, I am now trying to implement a bit of validation into the page and database.

I am trying to make the javascript pickup the email addresses previously entered into the database, and compare them to the one currently being entered into the form, using HTML5 'oninput' function. I have gotten this to work for another aspect, so I think there is an issue with my javascript.

PHP
Code:
$queryDisplayNames = mysql_query('SELECT displayname FROM userData');
$queryEmails= mysql_query("SELECT pemail FROM userData");

This is how I pickup my searches, and store them in the two php variables.

JAVASCRIPT

I then pickup that PHP code and store it in a Javascript variable. I don't think I am running the if statements correctly.
Code:
var displaynamesearched = "<?php echo $queryDisplayNames;?>";
        function availableDisplayName(input){
                if(input.value == emailsearched){
                        input.setCustomValidity('This display name is already in use.');
                }
                else {
                        input.setCustomValidity('');
                }
        }
        var emailsearched = "<?php echo $queryEmails;?>";
        function availableEmail(input){
                if(input.value == emailsearched){
                        input.setCustomValidity('This email is already in use.');
                }
                else {
                        input.setCustomValidity('');
                }
        }

Any help is greatly appreciated!