Currently getting an 'Unidentified Index' error for my PHP file.
I created a form on an HTML that requires users to enter info into a textbox. It's a basic calculation, like 5X3, so the user must enter '15'. I then need to use PHP as well as an if-else statement to determine if the user correctly entered the right number. But I believe that I have not properly set up my PHP file. This is my first time using PHP, so I'm not entirely sure what other alternatives to using. I have pretty much just structured my PHP file off examples from our lecture notes. Have I properly set everything up?
//HTML form code
<label for="Question 3">Question Three: <strong>2 X 9</strong></label><br>
<input type="text" id="Q3" name="Q3" placeholder="Type Answer Here"><br>
//PHP code for corresponding label
$Q3 = $_POST['Q3'];
//if statement regarding a particular question
if ($Q3 == "18")
{
echo "Well done, that's Correct!";
}
else
{
echo "Sorry, that's incorrect.";
}
Well done, that's correct! //if user inputs correct answer actual results:
Notice: Undefined index: Q1 in /Applications/XAMPP/xamppfiles/htdocs/CIT273/timetable.php on line 6
if(isset($_POST['Q3'])) { }and put your all php code inside this.