I have 2 functions
function checkFirstName($input) {
$pattern = '/[a-zA-Z]{2,15}/';
if(preg_match($pattern, $input)) {
return true;
} else {
return false;
}
}
function checkState($input) {
$pattern = '/[a-zA-Z]{2}/';
if(preg_match($pattern, $input)) {
return true;
} else {
return false;
}
}
I run them like…
if(checkFirstName($_POST['First_Name'])) { $_SESSION['First_Name'] = $input; } else { header('Location: index.php?error=1'); }
if(checkState($_POST['State'])) { $_SESSION['State'] = $input; } else { header('Location: index.php?error=5'); }
I have 2 problems, when I submit the form, this is what happens
why is the SESSION variable not set? heres that field
<input type="text" name="First_Name" class="form-control" id="name" value="<?=$_SESSION['First_Name']?>">
