The code below states my problem, I wanted the user to be redirected to another page when the gender was set to male and the option was set to child. thank you
<?php
$gender = $age = "";
$age = $_POST['age'];
if($_SERVER["REQUEST_METHOD"]=="POST")
{
if (empty($_POST['gender']))
{
$gendererr = "Please fill out your gender...";
}
if ($age == "SELECT")
{
$ageerr = "Please select if you are a child or an adult...";
}
if ($age === $_POST['child'] && $gender === $_POST['male'])
{
header('Location: childfather.html');
}
}
?>
Here is the HTML:
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
<div class="forms-background">
<span class="error"><?php echo $ageerr;?></span>
<br>
<select name="age">
<option name="option">SELECT</option>
<option name="child">Child</option>
<option name="adult">Adult</option>
</select>
<br>
<span class="error"><?php echo $gendererr;?></span><br>
<label>Male</label>
<input type="radio" name="gender" id="male" value="male"><br>
<label>Female</label>
<input type="radio" name="gender" id="female" value="female"><br>
<input type="submit" value="submit" class="submit">
</div>
</form>