enahs Posted May 29, 2008 Share Posted May 29, 2008 Hi, Is there a way to password protect an individual form in a webpage. For instance, lets say I have a page with two forms. Lets call one "info" and "additional info". Is there an easy way to make it such that in order to edit say the information in the "info" form, the user would have to enter a password first. This might seem odd, but it is in a complicated database application and I wish to do it this way for various reasons. Link to comment https://forums.phpfreaks.com/topic/107887-password-protect/ Share on other sites More sharing options...
Gighalen Posted May 29, 2008 Share Posted May 29, 2008 Hmmm... I've never heard of this before BUT.... You could create a form that could take a user submitted password, and then if it's correct it would load the same page over again with a $_POST['password'] field set, and then you can display the form like this: <?php ?> FORM1 <?php if(isset($_POST['pass'])){ ?> FORM2 <? } ?> /code] Don't know how secure that would be though. Link to comment https://forums.phpfreaks.com/topic/107887-password-protect/#findComment-553048 Share on other sites More sharing options...
Guardian-Mage Posted May 29, 2008 Share Posted May 29, 2008 More like this FORM1 <?php if(isset($_POST['pass'])){ if ($_POST['pass'] == "topsecret") { ?> FORM2 <? }} ?> Link to comment https://forums.phpfreaks.com/topic/107887-password-protect/#findComment-553051 Share on other sites More sharing options...
Gighalen Posted May 29, 2008 Share Posted May 29, 2008 Or better yet... FORM1 <?php if(isset($_POST['pass']) && $_POST['pass'] == 'topsecret'){ ?> FORM2 <?php } ?> Link to comment https://forums.phpfreaks.com/topic/107887-password-protect/#findComment-553076 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.