I am currently completing php a practice assessment and my browser tells me that variable "quan" on line 4 is undefined. My Programming Teacher is stumped as to what is wrong as my code seems to be correct.
Here is the error message I am receiving: Notice: Undefined index: quan in /Applications/XAMPP/xamppfiles/htdocs/phpassesment/shopping list/list.php on line 4
Html Form Page:
<form action="list.php" method="post">
<fieldset>
<legend>Shopping List</legend>
Name: <input type="text" name="name" placeholder="McLovin Juskinsky" pattern="[a-Z]{2,30}" autofocus><br>
Item: <input type="text" name="item" placeholder="olive oil" pattern="[a-Z]{2,30}"><br>
Quantity:<input type="text" name="quan" placeholder="0" pattern="[0-9]|[1-9][0-9]|100]"><br>
<input type="submit">
</fieldset>
</form>
PHP results page:
<?php
$yourName = $_POST["name"];
$yourItem = $_POST["item"];
$yourQuantity = $_POST["quan"];
echo "<h1>Welcome " . $yourName . "<h1>";
everything about this code works except "quan" is undefined for some unknown reason. Any help would be much appreciated!