Getting Undefined index errors when trying to use $_POST
- by Apoorv Agrawal
I'm getting the following error messages:
Notice: Undefined index: name in C:\xampp\htdocs\ApoorvProject\PostMethod.php on line 7
Notice: Undefined index: email in C:\xampp\htdocs\ApoorvProject\PostMethod.php on line 9
This is what line 7 and line 9 contains:
echo $_POST["name"];
echo "<br>";
echo $_POST["email"];
This is the body of my HTML documnent:
<form action="PostMethod.php" method="post">
Name: <input type="text" name="name" />
Email: <input type="text" name="email" />
<input type="submit" />
</form>
PostMethod.php is the name of my PHP file.