-1

I have a couple of PHP pages which begins with a secure session start. When I put a page title in the head section it says "headers already passed". How can I put page titles while securely starting a PHP function at the beginning of the page?

user2553342
  • 43
  • 2
  • 7

1 Answers1

1

If you are using session_start() Place your php script before any HTML code. You cannot use or have an output before session_start() not even an echo. e.g.

<?php
session_start();#creates a session or resumes the current 
include(lib/inc.php);
?>    
<!DOCTYPE html>
<html>
   <head>
      <title>Title</title>
   <head>
   <body>
     <p>text</p>
   <body>
</html>

An other solution if you must have an output is to use ob_start http://php.net/manual/en/function.ob-start.php

fredtma
  • 1,007
  • 2
  • 17
  • 27