JoshuaLuke
Posting Freak
- Jan 29, 2012
- 529
- 51
Hey there developers,
I'm creating a referal system for my CMS (Uber) and i'm wanting it to throw an error if the value inputted in a text box isn't a username in the database, heres my code:
But I have 2 problems, this happens:
That happens when a user goes onto the page, I need it to happen after the submit.
Also, I don't want the form to submit if the $checkRef is 0. How do I do this?
I'm creating a referal system for my CMS (Uber) and i'm wanting it to throw an error if the value inputted in a text box isn't a username in the database, heres my code:
Code:
$checkRef = (mysql_result(mysql_query("SELECT `username` FROM `users` WHERE `username` = '".$referal."'"), 0));
if($checkRef < '1') {
echo 'Error';
}
That happens when a user goes onto the page, I need it to happen after the submit.
Also, I don't want the form to submit if the $checkRef is 0. How do I do this?