Jump to content

The Loop


manalnor

Recommended Posts

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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.