Session in include

is there anyway for placing a session in include that is in the middle of the page e.g


include("1.php");
include("2.php");
include("3.php"); # This include contains session_start();

The reason I want to do this is because, 3.php will be dynamically loaded into the page multiple times. After the first load, it doesn’t recognize the session.

<?php
  if (!isset ($_COOKIE[ini_get('session.name')])) {
    session_start();
  }
?>

Will session start if not started yet. But I suggest that you session start on the top of the page witch includes the other files

I’m still getting this error:

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent

Start your session in the page that has the includes and the populate the session vars in include3.
The session start needs to be the first thing outputted to your browser otherwise you will get the headers error.