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 Link to comment https://forums.phpfreaks.com/topic/214544-the-loop/ 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 Link to comment https://forums.phpfreaks.com/topic/214544-the-loop/#findComment-1116416 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 ! Link to comment https://forums.phpfreaks.com/topic/214544-the-loop/#findComment-1116428 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 } Link to comment https://forums.phpfreaks.com/topic/214544-the-loop/#findComment-1116520 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.