Hello,

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

<?php
if(!filter_var($_POST['email'], FILTER_VALIDATE_EMAIL))
  {
 //email valid
  }
else
  {
  //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]'");
if(mysql_num_rows($check)<1){
//username availble
}
else{
//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, networking, learning, and sharing knowledge.