Well, its the first time i am writing up my own php instead of editing someone else's. Here is the very simple code where I am asking user to input a password and then just echo it. <form action="index.php" method="POST"> Please enter your password: <br> <input type="text" name="password" /> <br> <input type="submit" value="Submit" /> </form> <?php $password= $_POST['password']; echo $password; ?> PHP: And, I am getting following error: Notice: Undefined index: password in C:\wamp\www\md5\index.php on line 8 I have read everything I possibly could but still cant figure out whats wrong?
TRY this <?php if(isset($_POST['password'])) { $password= $_POST['password']; echo $password; } ?> PHP:
If you don't want the action to happend before you have clicked the button you must use isset. if(isset($_POST['buttonName'])) { // Action } Code (markup):
use isset() will do the trick. or you can set variable error_reporting(E_ALL ^ E_NOTICE); before everything