I am trying to take a value inside of if/else statement and send an error message with "that variable" because I don't want any of my inputs to be more than 99 characters.
This is the code:
if(empty($x) || empty($y) || empty($z)){
$_SESSION["ErrorMessage"]="You have to fill all the blanks.";
redirect_to("addxyz.php");
} elseif(strlen($x)>99 || strlen($y)>99 || strlen($z)>99){
$_SESSION["ErrorMessage"]="Very Long Name for /*variable name will be here*/";
redirect_to("addxyz.php");
} else {/*Rest of the code*/}
In the second part when I use strlen function with variables, I need to select one of it with an array or any other way but not using 3 different if/else statement. What would be the best way ?
Thanks in advance.