manalnor Posted September 27, 2010 Share Posted September 27, 2010 Hello friends, I've the following form code $pword = "123456"; <form method="post">Password <input type="password" name="password"><input type="submit" name="Submit"/> and it submit the password to the same page if (isset($_POST['password']) && $_POST['password'] == $pword) {echo "good";}else{echo "bad";} the problem when i do enter the password it reload the page and hence i get login input too so it is like look i wannt get echo "good"; if entered correct. thanks Quote Link to comment Share on other sites More sharing options...
Rifts Posted September 27, 2010 Share Posted September 27, 2010 you need to put the form in the if statement Quote Link to comment Share on other sites More sharing options...
manalnor Posted September 27, 2010 Author Share Posted September 27, 2010 i want extact to say if something show form else show anything but i wanna say if something show form if correct pass show good else show bad else show anything so how then it could be ? cause when i enter the password it loop and i get form again ! Quote Link to comment Share on other sites More sharing options...
Rifts Posted September 27, 2010 Share Posted September 27, 2010 you need something like if (isset($_POST['password']) && $_POST['password'] == $pword) { echo "good"; }else{ echo "bad <form method="post"> Password <input type="password" name="password"> <input type="submit" name="Submit"/> "; that should give u a start } 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.