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 9105503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T02:07:27+00:00 2026-06-17T02:07:27+00:00

So I am extremely new to PHP and am probably making a stupid mistake.

  • 0

So I am extremely new to PHP and am probably making a stupid mistake. I have searched for quite a while, though, and have not been able to figure out what is going wrong.

Using XAMPP all of the PHP works fine. When I load it onto my web server, however, the if statement regulating the log in form displays both the ‘log in’ form and the ‘log out’ form at the same time. Obviously not what I want!

Here is the code snippet:

<?php
   if ( isset( $_SESSION['email'] ) ) { // Check to see if user is logged in.  If so, display log out button.
?>
    <form class="navbar-form pull-right" action="logout.php" method="POST">
    <button name="submit" type="submit" class="btn btn-success">Log Out</button>
    </form>
<?php 
   } else { // display log in form
?>
    <form class="navbar-form pull-right" action="login.php" method="POST">
    <input name="email" type="text" class="span2" placeholder="email">
    <input name="password" type="password" class="span2" placeholder="password">
    <button name="submit" type="submit" class="btn btn-success">Log In</button>
    </form>
<?php 
   } 
?>

This is contained in a file index.php

The basic logic is test to see if an email variable has been created for the session (done in a login.php execution) to check if the user is logged in.

I have no idea if this is the best way to create a log in, but that’s what I’ve tried to do.

Again, I am very new to this, so any insight on where to look next would be greatly appreciated!

Thank you!

  • 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-17T02:07:28+00:00Added an answer on June 17, 2026 at 2:07 am

    Do a view source and make sure your PHP code is actually being interpreted. If you see your PHP tags in the source of the browser then your web server is not configured properly.

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

Sidebar

Related Questions

I am EXTREMELY new to the html/php scene but I have been working at
I'm a PHP dev and I'm new to Rails but have been getting on
I am extremely new to PHP and, although I am quite familiar to javascript,
I am extremely new to json and have been working on this issue for
I'm extremely new to Android so chances are I'm probably not doing something simple
I'm extremely new to TS and it's not apparent to me. It's seems to
I'm extremely new to JS and have this code that I'm trying to tweak.
I am pretty new to both php and mysql. I have a txt file
I am extremely new to PHP. I'd like to use prepared PDO statements, but
I have been using a php sql system to manage images on my website.

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.