I am just starting out learning PHP and i am getting an error in my code. I am currently watching a tutorial and i wrote it the exact same but it doesn't work.
The error message is
Notice: Undefined index: grade in C:\xampp\htdocs\victor\switchStatement\index.php on line 14
Here is my code:
<html>
<head>
<title></title>
</head>
<body>
<form action="index.php" method="post">
What was your grade?
<input type="text" name="grade">
<input type="submit">
</form>
<?php
$grade = $_POST["grade"];
switch($grade)
{
case "A":
echo "Wow that was really cool!";
break;
case "B":
echo "Wow that was... pretty cool.";
break;
case "C":
echo "Wow that wasn't that cool.";
break;
case "F" || "D":
echo "Wow that was really bad!";
break;
}
?>
</body>
</html>