> Hi James, thanks for replying.
> I've just done a little test on the server, and the session *is* getting
> passed in the include file.
> It appeared that the session wasn't getting passed in the include file (no
> errors).
> When I moved it to the main file, it did work.
> I must have gone wrong somewhere else. I'll check my code again.
> Brain overload, sorry.
> Regards, Bob.


here, try this:

:search.php:
<?php
if (isset($_SESSION['search']))
{
  $search = $_SESSION['search'];
  //echo "<p>$search</p>";
}
//echo "<p><a href='index.php'>Pass a SESSION variable</a></p>";
$_SESSION['search'] = "Hello";
echo headers_sent()?'bad':'ok';
?>


the thing is, the session functions use cookies. cookies are sent back to
the client computer in the http header. if anything is echoed back to the
client computer you can't send anything new in the header, so no new
cookies after that point. the headers_sent() function can tell you if it
is still ok to add more to the http headers or if the headers have already
been sent.

Reply via email to