I have a form, and I want to validate it with PHP, for that I going to make just one if
the problem is I want to detect where is the variable that equal to 0
My code
if(isset($_POST["submit"])){
$name = $_POST["name"];
$lname = $_POST["lname"];
if($name == "" || $lname == ""){
echo "Please, Enter All informations";
}
else {
$namepr = preg_match("/^[A-Za-z]{3,}$/",$name);
$lnamepr = preg_match("/^[A-Za-z]{3,}$/",$lname);
if($namepr == 0 || $lnamepr == 0){
<!-- here I want to select the variable that equal to 0 -->
}
else {
echo "Your name is : ".$name."<br>Your Last name is : ".$lname
}
}
}
my question is in the comment part, I want to show the variable equal to 0, I have two variable, I want to select the variable equal to 0