I am writing a code to for a registration form in php,i am done with adding field to database the problem is "validation" there are msnu feilds in the form .I have to validate two feilds in my form username and email before submiting (in short i have to check entered value is already avialable or not if yes then continue or display error)

please help

thank you

Recommended Answers

All 2 Replies

if(!filter_var($_POST['email'], FILTER_VALIDATE_EMAIL))
 //email valid
  //not valid
//in username u have to make select query to see if user exist in youre database
$check = mysql_query("select username from members where username='$_POST[username]'");
//username availble
//username taken

theres a lot of way to validate variables. do some experiment

cheers :)

thank you for your reply

but i want ajax validation to check if the user is already exist or not

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.