>> <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 Arash, It's hard to respond when it's unclear exactly what you want to do. I'm guessing that you want to simply have the same page show both the form, and also process the form, so that you can cut down on the number of pages you have to create. The way I do this is by first checking to see if the $_POST array has been set; if it has not been set, then I know that the form wasn't filled out, and so the script needs to print out the form. If the array has been set, on the other hand, then the script can process the form data. Here's a real quick example of what I mean: <?php if (!isset($_POST)) { ?> // The $_POST array is not set, so display the form <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 } else { // The $_POST array *is* set, so process the data $user=$_POST['user']; $pass=$_POST['pass']; if(($user=="myname")&&($pass="mypass")) { echo "access granted"; } else { echo "access denied"; } ?> Hope that helps. -- Richard S. Crawford (rscrawford@xxxxxxxxxxxx) http://www.mossroot.com Publisher and Editor in Chief, Daikaijuzine (http://www.daikaijuzine.com) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php