Thread: PHP Newbie
View Single Post
Old 06-27-2004, 01:54 AM   #1 (permalink)
pexeter
Registered User
 
Join Date: Jun 2004
Posts: 2
pexeter is on a distinguished road
PHP Newbie

Hi, Im just getting started with php and I ran into some problems with an example from a book. The code Im using is:

<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
<title>Chapter 1 Example. Figure 1.2</title>
</head>
<body>
<?php
if(!session_is_registered('nCount'))
{
session_register('nCount');
$nCount = 1;
}
else
{
$nCount++;
}
?>

<p>Hello, you have seen this page <?php echo $nCount; ?> times.</p>

<p>To continue, <a href="somepage.php?<?php echo strip_tags(SID)?>">click here (sompage.php?<?php echo strip_tags(SID)?>)</A></p>

</body>
</html>

When I run it I get the following error:

Warning: session_register(): Cannot send session cookie - headers already sent by (output started at C:\apache\public_html\example01_01.php:7) in C:\apache\public_html\example01_01.php on line 10

Warning: session_register(): Cannot send session cache limiter - headers already sent (output started at C:\apache\public_html\example01_01.php:7) in C:\apache\public_html\example01_01.php on line 10

Can anyone please help?
pexeter is offline   Reply With Quote