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

  • Home
  • SEARCH
  • 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 9117985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:01:46+00:00 2026-06-17T05:01:46+00:00

I am using PHP to check for $_SESSION variables at the top of an

  • 0

I am using PHP to check for $_SESSION variables at the top of an HTML page. Here is my code:

<?php require('sessions.class.php');
 $session= new session();
 $session->start_session('_s',false);

 if (!isset($_SESSION('session_id'))){
    header(location:'login.html');
  }
 ?>

<!DOCTYPE html>

Everything seems to work until the Object Operator (->) is reached. It’s like the server views this as the PHP closing tag. The text after -> is echoed at the top of the webpage.

This is similar to the question asked here:

why-php-tag-is-closing-on-user

But the OP did not go into the solution with much detail.

Browser= Mozilla

Any help would be appreciated. Thanks!

  • 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-17T05:01:47+00:00Added an answer on June 17, 2026 at 5:01 am

    The problem is probably that you are trying to run PHP code in an html document which is not possible. The < of the PHP opening tag is recognised as the start of an html tag and therefore the code after the first > is output as text, since it is interpreted as the closing of the html tag.

    If you want to use PHP, make it a .php file and echo the html. Better yet you want to separate your logic (PHPcode) and markup (html) in separate files as much as possible.

    Search for ‘separating PHP and html’
    To get you started

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

Sidebar

Related Questions

I am creating a PHP session using the following code: <?php session_start(); $_SESSION['loggedin'] =
I'm using curl in PHP to check the HTTP code when requesting some files,
How do I check if a facebook page, group, or person exists using php?
Using PHP, I am trying to delete a record, but I want to check
How do I check that the php script works? I'm using php -f filename.php
How do I check if a video exists on YouTube, using PHP?
Using PHP 5.3.3, PostgreSQL 8.4.11, pgbouncer 1.3.4 (in session mode) on CentOS 6.2 I'm
Thanks for taking a look: Here is the php I'm using to insert the
How can i send multiple sessions variables to a page? For example i have
Im currently new to PHP and JQuery after having using ASP.Net and C Sharp

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.