I am trying to collect data from text boxes, radials, checkboxes, etc and then display them with my display_results.php. However I keep encountering a nagging problem error undefined index but I thought I did define the index with my variable $num. I have not been instructed to use isset() function only $_POST since the form uses the form POST method. Could someone please point out why the variable isn't being indexed and displayed without isset()?
Thanks for any help!
<?php
// get the data from the form
$email = filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL);
// get the rest of the data for the form
$password = filter_input(INPUT_POST, 'password');
$num = filter_input(INPUT_POST, 'num');
$heard_from = filter_input(INPUT_POST, 'heard_from' ); ?>
<!DOCTYPE html>
<html>
<head>
<title>Account Information</title>
<link rel="stylesheet" type="text/css" href="main.css"/>
</head>
<body>
<main>
<h1>Account Information</h1>
<label>Email Address:</label>
<span><?php echo htmlspecialchars($email); ?></span><br>
<label>Password:</label>
<span><?php echo $_POST['password']?></span><br>
<label>Phone Number:</label>
<span><?php echo $_POST['num']?></span><br>
<label>Heard From:</label>
<span><?php echo $_POST['heard_from']?></span><br>
</main>
</body>
</html>