manalnor Posted September 27, 2010 Share Posted September 27, 2010 Hello friends, If i've $pass = "12345"; // in database or whaever the form code <form method="post" name="name" id="id" action="post">Password <input type="password" name="password"><input type="hidden" name="Submit"/> i wanna say on same if if post password == $passecho "good";} else {echo "bad";} how then it be on same page ? and if post ( how to write it ) thanks alot that would help me so much in php Link to comment https://forums.phpfreaks.com/topic/214527-on-same-page/ Share on other sites More sharing options...
DigitalMind Posted September 27, 2010 Share Posted September 27, 2010 <?php ... if (isset($_POST['password']) && $_POST['password] == $pass) { echo "good"; } else { echo "bad"; } ?> Link to comment https://forums.phpfreaks.com/topic/214527-on-same-page/#findComment-1116295 Share on other sites More sharing options...
DigitalMind Posted September 27, 2010 Share Posted September 27, 2010 or <?php if (!isset($_POST['password'])) { echo $your_html_form; } else { if ($_POST['password] == $pass) { echo "good"; } else { echo "bad"; } } ?> Link to comment https://forums.phpfreaks.com/topic/214527-on-same-page/#findComment-1116297 Share on other sites More sharing options...
DigitalMind Posted September 27, 2010 Share Posted September 27, 2010 or <?php if (isset($_POST['password']) && $_POST['password] == $pass) { header('Location: passed.php'); } ?> your html code Link to comment https://forums.phpfreaks.com/topic/214527-on-same-page/#findComment-1116299 Share on other sites More sharing options...
manalnor Posted September 27, 2010 Author Share Posted September 27, 2010 thank you so much for all that examples Link to comment https://forums.phpfreaks.com/topic/214527-on-same-page/#findComment-1116303 Share on other sites More sharing options...
DigitalMind Posted September 27, 2010 Share Posted September 27, 2010 you're welcome! i hope it helped you Link to comment https://forums.phpfreaks.com/topic/214527-on-same-page/#findComment-1116308 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.