Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9194687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:28:20+00:00 2026-06-17T21:28:20+00:00

I have a simple php – password protecton / login based on a form

  • 0

I have a simple php – password protecton / login based on a form which works. PHP-code is in page “secure.php” and includes the html-file “accessed.html” when user + pass is correct.

But i want the form to hide when hidden page (accessed.html) is shown.
I have tried wrapping the form in a div and using javascript and display: none to hide, but it doesnt work – not locally or on server.

What am i doing wrong? It doesnt have to be js hiding the form after login..

PHP in top

    <?php
$user = $_POST['user'];
$pass = $_POST['pass'];

if($user == "a"
&& $pass == "a")
{
        include("accessed.html");
         echo "<script>
                    document.getElementById('wrap').style.display = 'none';
                </script>";
}

if(isset($_POST))
?>

And the form in the body:

    <div id="wrap">
    <form method="POST" action="secure.php">
        User <input type="text" name="user"></input>
        Pass <input type="text" name="pass"></input>
        <input type="submit" name="submit" value="access page"></input>
    </form>
</div>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T21:28:21+00:00Added an answer on June 17, 2026 at 9:28 pm

    Move the <script> to after wherever you display “#wrap“

    If you want to do it on the server side (PHP) just use an if statement.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple php login page. When user and password is correct i
I have a simple php page which outputs a table (which has been created
I have a simple php script which I use in form on my website.
I have a simple php code which loads an external XML file and loads
I have a simple navigation php script which works ok. The only problem is
I have a very simple PHP script which creates favicon.ico form jpg/gif/png uploaded file.
I have simple php validation form that is halfway working. If you leave the
I have a simple php page that displays data from a mysql database. I
Here I have a simple php script which displays some values from a database
i have made a simple php contact form following this tutorial: http://www.catswhocode.com/blog/how-to-create-a-built-in-contact-form-for-your-wordpress-theme The big

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.