I have tried with below code. the code only validating "yourname". yourlname and umobile not validating. Please let me know the mistake which I have done in the code.
if(strlen($yourname)<4)
{
$output = json_encode(array('type'=>'error', 'text' => 'Name is too short!'));
die($output);
}
if(strlen($yourlname))
{
$output = json_encode(array('type'=>'error', 'text' => 'Please enter Last Name'));
die($output);
}
if(strlen($umobile))
{
$output = json_encode(array('type'=>'error', 'text' => 'Please enter Mobile Number'));
die($output);
}
strlenReturns the length of a string on success, and 0 if the string is empty and you always enter in if condition. Instead use!empty($yourlname){}