Hey guys,
Just need a little help with wrapping my mind around all this. Just started my first project... gonna try to do like a multi-user login type of page like Geocities or something. Anyhow here is what I would like to do. (Using PHP5 and Navicat Lite to view MySQL).
Sign up Page:
Keeping it simple, let's say the DB has the fields Username, Password, and Email. Username and Email I set as keys in the database.
The form on the page requires that there be no blanks for either field when signing up. Basically I got something like this when user hits Submit:
if($_REQUEST['username'] == "")
{
$errors['username']= "
<font color='red'>
<b>Username</b>
cannot be blank.
</font>";
}
I do that for all three, (adjusting the key name) and I then echo the $errors
array variable for the respective form fields. If the field is blank, the error will
post back to the page and appear right next to the offending field... so far that much I've figured out.
I'm confused as how I should go about verifying the data in the database to
make sure Username and Email do not have duplicate entries and display that error next to the field too.
I noticed when I set the field to a key, it automatically sends the duplicate data error back but I wanna capture that so I can post it next to the field and not lose the form data either.
Should I be using Sessions or Cookies at this point?