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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.