- Edited
<label for="age">Age:</label>
<input type="date" id="age" name="age" required/>
<p>You should select one age example09/04/1984.</p>
<label for="sex">Sex:</label>
<input type="radio" id="man" name="sex" value="man" required />
<label for="man">Man</label>
<input type="radio" id="women" name="sex" value="women" required />
<label for="women">Women</label>
<p>You should select one sex example Man.</p>
it's not doing the insert in the database
echo $sex_validation; it`s not working
$sex_validation = preg_replace("/man|women/","",$sex);
echo $sex_validation;
$age_validation = preg_replace("/(19[0-9][0-9]|20[0-9][0-9]){4}-[01-12]{2}-[01-31]{2}/","", $age);
echo $age_validation;
print_r(date_parse_from_format("Y-n-j",$age_validation));
if(date_parse_from_format("Y-n-j",$age_validation)&& $sex_validation ){
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$link = mysqli_connect("localhost", "root", "P-11fl32fg14", "check-in");
$query = "INSERT INTO check-in (age,sex) VALUES ('$age_validation ','$sex_validation ')";
echo $query;
mysqli_query($link, $query);
mysqli_close($link);
}
elseif(!empty($age_validation) && !empty($sex_validation)){
echo "All heads are mandatory";
}