Rifts Posted October 20, 2010 Share Posted October 20, 2010 I'm trying to make the simplest login and this isnt working can someone explain why? thanks if ($_POST['user'] == 'admin' && $_POST['pass'] != '1234') { echo "fail"; } else { echo "win"; no matter what I do it says win Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted October 20, 2010 Share Posted October 20, 2010 Have you tried echoing out $_POST['user'] and $_POST['pass']? Quote Link to comment Share on other sites More sharing options...
Rifts Posted October 20, 2010 Author Share Posted October 20, 2010 yeah and they are 100% correct Quote Link to comment Share on other sites More sharing options...
PaulRyan Posted October 20, 2010 Share Posted October 20, 2010 This is most likely one of the following reasons: 1 - The pass vaildation is using Not Equal To(!=) instead of Equal To (==) 2 - The form input fields are not named correctly. Change the names to match. If you are still stuck post your whole code, so we can have a look over it. Regards, Paul. Quote Link to comment Share on other sites More sharing options...
samtwilliams Posted October 20, 2010 Share Posted October 20, 2010 Try this; <?PHP if ($_POST['user'] == 'admin' && $_POST['pass'] == '1234') { echo "fail"; } else { echo "win"; }?> Quote Link to comment Share on other sites More sharing options...
Rifts Posted October 20, 2010 Author Share Posted October 20, 2010 yeah i actaully just changed it to this and it workes now if ($_POST['login'] == 'admin' && $_POST['pass'] == '1234') { echo "win"; } else { echo "fail"; } Quote Link to comment Share on other sites More sharing options...
j.smith1981 Posted October 20, 2010 Share Posted October 20, 2010 I always have the same trouble, just fiddling around with it usually helps myself. Its like I always use if(!isset($_SESSION)) is the one I start off with and then just bump it up later on, adding an stage of it every time to see where I am going wrong usually helps me, but thats just my way of doing things. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.