[solved] Why does the code Inside if statement of PHP file is not executing? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

[solved] Why does the code Inside if statement of PHP file is not executing?

I have created a HTML page in blogger which takes password input from user and transfer the password to my another site. Where my PHP file is stored. Html code in blogger page: <div dir="ltr" style="text-align: left;" trbidi="on"> <html lang="en"> <head> <title>Password Protect</title> </head> <body> <table> <form action="https://www.wallpapersforandroid.com/quantum.php" method="post"> <tr> <td> password: </td> <td> <input name='pass' type='password'/></td> </tr> <tr> <td colspan="2"> <center> <input type=submit value=submit /> </center> </td> </tr> </table> </body> </html> </div> PHP file code stored in my another site: <?php if ($_POST['pass'=='gogo']) { echo 'welcome to the secret page'; } else { echo 'incorect pass'; } ?>

15th May 2020, 6:30 AM
Ashish Sah
Ashish Sah - avatar
3 Answers
+ 1
I found out the silly mistake. If($_POST['pass'=='gogo']) doesn't make sense There will be If($_POST['pass']=='gogo') instead.
15th May 2020, 7:09 AM
Ashish Sah
Ashish Sah - avatar
+ 1
Mark your thread [SOLVED] please, people may be mistaken thinking the problem is not yet solved 👍
15th May 2020, 7:25 AM
Ipang
+ 1
put a name for your submit button name=“submit”then : If(isset($_POST[“submit”])){ $pass =$_POST['pass']; if($pass== “gogo”){ echo “welcome” ; }else{echo “incorect”;} }
15th May 2020, 10:13 AM
Ahmad Al-Zreqat
Ahmad Al-Zreqat - avatar