Getting Undefined index errors when trying to use $_POST

Posted by Apoorv Agrawal on Stack Overflow See other posts from Stack Overflow or by Apoorv Agrawal
Published on 2014-06-03T02:57:34Z Indexed on 2014/06/03 3:26 UTC
Read the original article Hit count: 184

Filed under:
|
|

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.

© Stack Overflow or respective owner

Related posts about php

Related posts about forms