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
https://forums.phpfreaks.com/topic/163042-invalid-sign-up-or-registration-page/
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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.