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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:40:04+00:00 2026-05-29T05:40:04+00:00

I have a website with a white space problem. I am including a few

  • 0

I have a website with a white space problem. I am including a few files before the doctype
and this is causing a white space to be outputted.

After searching I have found this solution:
Problem with whitespace before doctype

However after removing ?> I am still getting the problem. Below is the code:

<?php
include ("include/session.php");
include ("include/updatestage.php");                                        
?>
<!DOCTYPE HTML>....

Here is session.php:

<?php session_start();

// if a team name has been assigned to a session...
if ( isset($_SESSION ['teamName']))
{

//create "global variable $teamName that can be used across all pages as long as the function "session_start(); is present"
$teamName = $_SESSION ['teamName'];

}
else{

die ( "You are not logged in! Redirecting to login page...<meta http-equiv='REFRESH' content='2; url = index.php'>");

}

Here is updatestage.php:

<?php
include("config.php");
//update stage

$inserted="n";
mysql_query ("UPDATE `team` SET `inserted`='$inserted' WHERE teamName = '$teamName' ");

$advance="n";
mysql_query ("UPDATE `game` SET `advance`='$advance' ");

Here is getstageinfo.php:

<?php
include("include/config.php");
//Select the slogan from the current user
$currentStage = mysql_query("
SELECT `currentStage` FROM `team` WHERE `teamName` = '$teamName'
");
//assign the text located at the logo field (the path of the logo) to a variable $slogan
$row = mysql_fetch_assoc($currentStage);
$currentStage= $row['currentStage'];
?>

And finally here is config.php:

<?php
// connect to database
$con = mysql_connect("xxxxxxx","xxxxxxx","xxxxxxx"); 

if (!$con)
      {
      die('Could not connect: ' . mysql_error());
      }

// select database 
mysql_select_db ("xxxxxxx");          
?>

//////////////////////////////////////////////////////////////////////////////////////////

Ok so I have added back in the ?> and tried the suggestions below:

<!DOCTYPE HTML>
<?php
include("include/session.php");
include("include/updatestage.php");
?>

Or trying:

<?php

echo "<!DOCTYPE HTML>\n";

include ("include/session.php");
include ("include/updatestage.php");

?>

Produces:

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at public_html/period1.php:2) in public_html/include/session.php on line 1

Trying:

<?php
include("include/session.php");
include("include/updatestage.php");
?><!DOCTYPE HTML>

Or:

<?php

  ob_start();

  echo "<!DOCTYPE HTML>\n";

  include ("include/session.php");
  include ("include/updatestage.php");

  ob_end_flush();

?>

Still produces the white space.

  • 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-05-29T05:40:04+00:00Added an answer on May 29, 2026 at 5:40 am

    You may be able to fix the problem like this:

    <?php
    include ("include/session.php");
    include ("include/updatestage.php");                                        
    ?><!DOCTYPE HTML>
    

    But I have observed buggy behaviour in this respect (although not since PHP4), so the easiest solution that guarantees a fix is to put the <!DOCTYPE> before the include – since neither included file outputs anything, and would break your document if it did.

    <!DOCTYPE HTML>
    <?php
    
      include ("include/session.php");
      include ("include/updatestage.php");
    
    ?>
    <!-- Rest of HTML -->
    

    Or this:

    <?php
    
      echo "<!DOCTYPE HTML>\n";
    
      include ("include/session.php");
      include ("include/updatestage.php");
    
    ?>
    <!-- Rest of HTML -->
    

    Remember to make sure that the < in the opening <?php tag is the first character in all files if you go with the second option.

    EDIT Having in the first place completely failed to take into account the session/cookies problem that has reared it’s ugly head, here is a working solution:

    <?php
    
      ob_start();
    
      echo "<!DOCTYPE HTML>\n";
    
      include ("include/session.php");
      include ("include/updatestage.php");
    
      ob_end_flush();
    
    ?>
    <!-- Rest of HTML -->
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem I haven't seen before. I am doing a realign on
I have a website with a Flash banner. This has worked fine in all
Let's say we have a string in JavaScript This is a nice website -
I have a rendering error in this website which I haven't seen anywhere else.
I have a website with a small searching script, where I use utf-8 charset.
For some reason my website won't use my styles! I have this in my
I have this problem with one of the mobile websites i built, there is
I have a few simple questions about data storage on a website I am
At my personal website while viewing a single post, i have an overview DIV,
I have been asked to write a compliment website/service for an iPhone app. The

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.