Jump to content

Recommended Posts

I know that session_start() has to be at the very top of the page and cannot have any white spaces before etc but I can't figure out why I am receiving this error:

 

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/though/public_html/test/signup_form.php:1) in /home/though/public_html/test/signup_form.php on line 2

 

The full code for the page is:

<?php
session_start();
include "write_templates.php";
write_head("title here etc etc", false);
?>
<?php	
if (isset($_SESSION['xxx']))
{
	echo "You are already logged in as $_SESSION[xxx], if this is not you, logout.";
}
else
{
	echo "<form method='post' action='signup.php' name='input' class='style2'>";
	echo "<p>";
	echo "Username:<br />";
	echo "<input type='text' name='username' /><br /><br />";
	echo "Password:<br />";
	echo "<input type='password' name='password' /><br /><br />";
	echo "Name:<br />"; 
	echo "<input type='text' name='name' /><br /><br />";
	echo "Date of Birth (DD/MM/YYYY):<br />";
	echo "<input type='text' name='dayofbirth' />";
	echo "<input type='text' name='monthofbirth' />";
	echo "<input type='text' name='yearofbirth' /><br /><br />";
	echo "<input type='submit' value='Send' />";
	echo "<input type='reset' value='Reset' />";
	echo "</p>";
	echo "</form>";
}
?>
<?php
write_footer();
?>

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/187560-warning-session_start/
Share on other sites

If there are no actual characters before the <?php tag, then your file has been saved as a UTF-8 encoded file and the BOM (Byte Order Mark) characters that your editor placed at the start of the file are the problem. You either need to save the file as an ANSI file or if you must save it as a UTF-8 encoded file, save it without the BOM.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.