'; if(empty($_POST['user_name'])){ $error .= 'User Name can\'t be empty
'; } if(empty($_POST['fname'])){ $error .= 'First Name can\'t be empty
'; } if(empty($_POST['lname'])){ $error .= 'Last Name can\'t be empty
'; } if(empty($_POST['email'])){ $error .= 'Email can\'t be empty
'; } if(empty($_POST['password'])){ $error .= 'Password can\'t be empty
'; } if(empty($_POST['re_password'])){ $error .= 'You must re-type your password
'; } if($_POST['password']!=$_POST['re_password']){ $error .= 'Passwords don\'t match
'; } if($row){ $error .= 'User Name already exists
'; } $error .= '

' }else{ # If all fields are not empty, and the passwords match, # create a session, and session variables, $query = sprintf("INSERT INTO users_table(`user_name`,`f_name`,`l_name`,`email`,`password`) VALUES('%s','%s','%s','%s',PASSWORD('%s'))", mysql_real_escape_string($_POST['user_name']), mysql_real_escape_string($_POST['fname']), mysql_real_escape_string($_POST['lname']), mysql_real_escape_string($_POST['email']), mysql_real_escape_string($_POST['password']))or die(mysql_error()); $sql = mysql_query($query); # Redirect the user to a login page header("Location: login.php"); exit; } } # echo out each variable that was set from above, # then destroy the variable. if(isset($error)){ echo $error; unset($error); } ?>

User Name:
/>

First Name:
/>

Last Name:
/>

Email:
/>

Password:

Re-Type Password: