Jump to content

Invalid sign-up or registration page


gaspan1984

Recommended Posts

Hi Masters I have some problem about handling errors. I have already create a script that add an information that they input to the registration page and send it in database. the problem now is how can I show the invalid message in the same script like empty string or the username is already taken.

 

username: |username|    username is already taken/fill the  box

 

something like that!

Link to comment
Share on other sites

You said you want it to verify AFTER they hit submit?

 

$userName = $_POST['userName'];

if($userName=='')
{
redirect and echo box was left blank
}else{

$sql = "SELECT * FROM yourtable WHERE username='$username'";
$result = mysql_query($sql,$con);

if($result != '0')
{
insert the stuff into the database
}else{
redirect and echo the username is taken
}
}

 

Sorry if that's totally wrong, it's been a few days.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.