daniel5455 Posted April 26, 2008 Share Posted April 26, 2008 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/valconu/public_html/newsite/index.php:3) in /home/valconu/public_html/newsite/index.php on line 4 This is the error i receive. I tried removing any whitespace in the code and same thing. Here is the code <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Title</title> <link href="css/style.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="main"> <div id="logo"><a href="index.php"><img src="images/logo.gif" alt="" border="0" style="display:block;float:left;" /></a> <?php session_start(); if (!(isset($_SESSION["userid"]))) { echo '<span style="font-size: 11px; color: #000000; font-family: Tahoma, Verdana"><span lang="en-us"><font size="2" color="#EF5494">* </font> <a href="register.php"><font size="2" color="#EF5494">Create Account!</font></a></span> '; echo '<a href="login.php"><strong>Login</strong></a>'; } else { echo '<a href="changepassword.php">Change Password</a> '; echo '<a href="logout.php"><strong>Logout</strong></a>'; } ?> <div id="navbar"> <ul> <li><a href="index.php">Home</a></li> <li><a href="about.php">Aboutus</a></li> <li><a href="services.php">Services</a></li> <li><a href="products.php">Products</a></li> <li><a href="contact.php">Contact</a></li> <?php if ((isset($_SESSION["userid"]))) echo '<li><a href="tickets.php">Tickets</a></li>'; ?> </ul> </div> </div> <div id="mainphoto"><img src="images/photo-main.jpg" alt="" /><a href="about.php"><img src="images/statement-main.gif" alt="" border="0" /></a></div> <div class="clear"></div> <div id="main-inner"> <div id="main-inner-left"> <h1>Welcome</h1> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <!--DWLayoutTable--> <tbody><tr> <td height="43" width="8"> </td> <td width="141"> </td> <td width="97"> </td> <td width="134"> </td> <td width="53"> </td> <td width="83"> </td> <td width="43"> </td> </tr> <tr> <td colspan="6" height="171" valign="top"><p> </p> <p></p></td> <td> </td> </tr> <tr> <td height="15"></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td colspan="5" height="61" valign="top"><table border="0" cellpadding="0" cellspacing="0" width="100%"> <!--DWLayoutTable--> <tbody><tr> </tr> </tbody></table></td> <td> </td> <td></td> </tr> <tr> <td height="16"></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td height="18"></td> <td></td> <td></td> <td rowspan="3" valign="top"><table border="0" cellpadding="0" cellspacing="0" width="100%"> <!--DWLayoutTable--> <tbody><tr> <td height="90" valign="top" width="134"><!--DWLayoutEmptyCell--> </td> </tr> </tbody></table></td> <td></td> <td></td> <td></td> </tr> <tr> <td height="24"></td> <td></td> <td></td> <td></td> <td valign="top"><div class="style1" align="center"> <div align="left"> </div> </div></td> <td></td> </tr> <tr> <td height="15"></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> <tr> <td height="36"></td> <td></td> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> </tbody></table> </div> <div class="clear"></div> </div> <div class="clear"></div> </div> <div id="footer"> © </body> </html> any suggestion on how to fix this and why im getting this. Link to comment https://forums.phpfreaks.com/topic/103066-session_start-error/ Share on other sites More sharing options...
BlueSkyIS Posted April 26, 2008 Share Posted April 26, 2008 session_start(); must come before ANY output, including the HTML you have above it. Link to comment https://forums.phpfreaks.com/topic/103066-session_start-error/#findComment-527918 Share on other sites More sharing options...
daniel5455 Posted April 26, 2008 Author Share Posted April 26, 2008 i put it at the top and same thing. Link to comment https://forums.phpfreaks.com/topic/103066-session_start-error/#findComment-527931 Share on other sites More sharing options...
BlueSkyIS Posted April 26, 2008 Share Posted April 26, 2008 can we see updated code, please? Link to comment https://forums.phpfreaks.com/topic/103066-session_start-error/#findComment-527935 Share on other sites More sharing options...
daniel5455 Posted April 26, 2008 Author Share Posted April 26, 2008 weird i was messing with this all day and i reput the code on the top and it worked. I dont understand why now. Maybe there was and extra whitespace that i missed before. i have this on a few pages of the site. Can i use the include statement to call this session code. Link to comment https://forums.phpfreaks.com/topic/103066-session_start-error/#findComment-527950 Share on other sites More sharing options...
BlueSkyIS Posted April 26, 2008 Share Posted April 26, 2008 yes. Link to comment https://forums.phpfreaks.com/topic/103066-session_start-error/#findComment-527952 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.