I am trying to get the values of 3 input boxes when the submit button is clicked using PHP. However, when I run my code it shows -
Undifined Index
How should I fix this? Thanks in advance.
My Code -
<!DOCTYPE html>
<html>
<body>
<form method="post">
<input type="number" min="0" id="Q1" name="Q1"><br>
<input type="number" min="0" id="Q2" name="Q2"><br>
<input type="number" min="0" id="Q3" name="Q3">
<input type="submit" id="submit2">
</form>
<?php
if(isset($_POST['submit2'])){
$submitButton = $_POST['submit2'];
if ($submitButton == true) {
$input1 = $_POST['Q1'];
$input2 = $_POST['Q2'];
$input3 = $_POST['Q3'];
echo $input1;
}
}
?>
</body>
</html>