# Password Protected page help

**URL:** <https://www.phphelp.com/t/password-protected-page-help/19831>\
**Category:** Security and PHP\
**Created:** [March 13, 2013, 1:50am UTC](https://www.phphelp.com/t/password-protected-page-help/19831 "2013-03-13T01:50:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![robertjones6](https://www.phphelp.com/letter_avatar_proxy/v4/letter/r/f9ae1b/32.png) [@robertjones6](https://www.phphelp.com/u/robertjones6)\
**Post date:** [March 13, 2013, 1:50am UTC](https://www.phphelp.com/t/password-protected-page-help/19831/1 "2013-03-13T01:50:11Z")

</div>

heres the code, im new to php and any advice on what i did wrong or the solution would be appreciated

[code]

Amy-Grace Web Chat body { background: #33FF99; }

#center {  
margin-left:500px;  
margin-right:500px;  
margin-top: 100px;  
overflow:none;  
}

\<?php $password = "robsam"; //Change to whatever you want your password to be

if(isset($\_POST[‘submit’])){  
if($\_POST[‘password’] == $password){

  
[Get your own Chat Box!](http://xat.com/web_gear/?cb) [Go Large!](http://xat.com/web_gear/chat/go_large.php?id=192364512)  

 echo "Please enter Password to proceed"; } else { echo "sorry the password were incorrect"; } } else { ?\> Password: \<?php }

?\>

[/code]

---

<div class="post-metadata">

**Author:** ![robertjones6](https://www.phphelp.com/letter_avatar_proxy/v4/letter/r/f9ae1b/32.png) [@robertjones6](https://www.phphelp.com/u/robertjones6)\
**Post date:** [March 13, 2013, 2:28am UTC](https://www.phphelp.com/t/password-protected-page-help/19831/2 "2013-03-13T02:28:53Z")

</div>

my aim is to create a page that asks for a password and once you enter the correct password it will show the content otherwise it will display a message saying incorrect password

---

<div class="post-metadata">

**Author:** ![robertjones6](https://www.phphelp.com/letter_avatar_proxy/v4/letter/r/f9ae1b/32.png) [@robertjones6](https://www.phphelp.com/u/robertjones6)\
**Post date:** [March 13, 2013, 4:07am UTC](https://www.phphelp.com/t/password-protected-page-help/19831/3 "2013-03-13T04:07:19Z")

</div>

can a moderator hide the code and lock the thread its been solved
