PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I'm not sure if the subject was right for this or not... but, what I have is a simple password field, and it submits to itself, and at the top of the page i have it check if the $password == "whatever" but when the first time the page is loaded i get the stupid undefined index: password error thingy on top, then everything else works... well... this is what i'm doinge:
Well if you are going to have a multiple user login system you might want to consider using a database to compare passwords. Right now, are you using GET (passing the variables via the URL) or POST (passing the data invisibly) in your form? Using the correct method for the $_REQUEST["password"] is usually preferred. So if you are using GET use: $_GET["password"] and for POST use: $_POST["password"]. This might be the problem.
I'm not doing anything with users... I just have a page that is passworded....
And i was using post, so i changed it first to $_POST and it still didn't work.... so i also changed the action part to what u had, and it still was giving my that error....
Other than that first warning at the top, everything else works... like i can still log in and everything.... and when i enter an incorrect password, that error goes away... because the $password is set ... i was thinking maybe i could first use an if isset, but then i would have to go through more throuble than its worth.... maybe, maybe not, lemme try it real quick...
I know how to pass using get and post. The problem i was having was getting an error because i was trying to compare a variable that did have anything stored in it.... But i got it fixed now - i just turned off error notices.... But for some reason i couldn't get it to work by turning it off in the php.ini file, so i had to do it within my script... But allt he same it works now! Thanks
I am using post and $_POST... but the only thing is that i have it check the password at the top of the page and when i first load the page, there is nothing in that variable so thats why i'm getting that notice....