This form validation is supposed to let the spouse field be optional Instead its making it mandatory, if it has a value and its less then 2, or if its over 20 characters fail. Am i doing something wrong?
😕
if(isset($_POST['spousename']) === true && strlen($_POST['spousename']) < 2 || strlen($_POST['spousename']) > 20)
{
$errors[] = "Your spouse's first name is required.<br />";
}else{
$sn = trim($_POST['spousename']);
}