newbie: problem with $_Post[]
| From: | A.a.k | Date: | Tue, 28 Jul 2009 02:31:24 +0000 |
| Subject: | newbie: problem with $_Post[] | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-295906@lists.php.net to get a copy of this message | ||
Hello
I have a very simple test form named "pass.php" :
<form action="pass.php" method=POST>
username : <input type=text name=user ><br />
password : <input type=password name=pass> <br />
<input type=submit value="go"><p>
</form>
<?php
$user=$_POST['user'];
$pass=$_POST['pass'];
if(($user=="myname")&&($pass="mypass"))
echo "access granted";
else
echo "access denied";
?>
getting "Notice: Undefined index: user" and "Notice: Undefined index: pass".
changing form action to another page will solve the problem but i want to be able to use $_POST array on the same page, how can i do it?
thanks in advance
/Arash