For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > May 2007 > Re: [PHP-DB] $_POST["mypassword"]; ***Undefined index: mypassword









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PHP-DB] $_POST["mypassword"]; ***Undefined index: mypassword
Dimiter Ivanov

2007-05-14, 6:58 pm

On 5/14/07, Chetanji <chetan_graham@amritatech.com> wrote:
>
> Thanks for the reply, this is the only output before and after the
> $_POST....
>
> array(0) { } ......that's it
>
> I still have the two Notice's from PHP.
> But the program works otherwise, in checking the DB for the hashed
> password...
> that matches the typed in username ...
> that is then hashed itself
> in the login.php program.
> It works and doesn't 'auth' for incorrect user/pass combinations.
> However, I do not like running programs that kick out 'errors' of any kind.
> It seems to always lead to unpredictable situations that are a problem.
> Any other ideas?
> Thanks,
> Chetanji


Well then the $_POST array is empty that's why you have those notices.
The $_POST array is populated with values ONLY after the form was
submitted to the login.php script.
If you use this script before the form was submitted or in any other
context, then you will get those notices.

If you check if the variables you are looking for are set, before
assigning them, you will not get the notices.

Try this:
if(isset($_POST["myusername"] AND isset($_POST["mypassword"])){
$myusername=$_POST["myusername"];
$mypassword=$_POST["mypassword"];
}
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com