<?Php
error_reporting(0);// With this no error reporting will be there
///////////////////////
$elements=array("form_status"=>'OK',"userid"=>'T',"msg"=>'');
$userid=$_POST['userid'];
if(!ctype_alnum($userid)){
$elements['msg'].=$msg."Please use characters or numbers for your User ID<BR>";
$elements['form_status']= "NOTOK";
$elements['userid']='F';
}
if ( strlen($userid)< 6 OR strlen($userid) > 10) {
$elements['msg'].="User ID should not be less than 6 and more than 10 character length<BR>";
$elements['form_status']= "NOTOK";
$elements['userid']='F';
}
/// Checking from database ////
require "config.php"; // database connection string
$count=$dbo->prepare("select userid from site_member_table where userid=:userid");
$count->bindParam(":userid",$userid);
$count->execute();
$no=$count->rowCount();
if($no >0 ){
$elements['msg'].="User Name already exists. Choose a different User Name<br>";
$elements['form_status']= "NOTOK";
$elements['userid']='F';
}
////////////
echo json_encode($elements);
?>