Jump to content

[SOLVED] Cannot send session cookie- headers already sent


tim101011

Recommended Posts

I get these warnings on most of my sites pages:

 

e.g

 

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /var/www/vhosts/propertyeagle.co.uk/httpdocs/searchproperties.php:19) in /var/www/vhosts/propertyeagle.co.uk/httpdocs/searchproperties.php on line 43

 

I have read a lot about these header errors, but never really understood the resolution to the problem. They don't seem to be stopping the site from working in any way, so I am tempted to just down the level of error/warning messages displaying on the actual pages:

 

error_reporting(E_USER_WARNING);

 

 

Am I being foolish not to resolve the problem? How would actually resolving the problem improve my site? Would it make it quicker?

 

 

That didn't work. I think the trouble is that I have HTML code above the PHP code:

 


<html>
<head>
<meta http-equiv="Content-Language" content="en-gb">
<meta http-equiv="Content-Type" content="text/html; charset=WINDOWS-1252">
<title>Propertyeagle.co.uk: Search Properties</title>
</head>
<body>
<p><img border="0" src="logo.GIF" >






<font face="Verdana" size="1"> 
<br>


<?php 

//error_reporting(E_USER_WARNING);

session_start();
$tempflag= $_GET['id'];

if ($tempflag == '1') {
$keywords=$_POST['keywords'];		//keywords
$keywordscriteria=$_POST['R1']; 	//keywords criteria
$minprice=$_POST['minprice'];		//minimum price
$maxprice=$_POST['maxprice'];		//maximum price
$daysposted=$_POST['daysposted'];	//how many days back to search
$resultsortcriteria=$_POST['R2']; 	//criteria used to sort results
$resultsortcriteriab=$_POST['R2']; 	//criteria used to fix problem with checkbox not sticking





no, no, like this

 

<?php 
/error_reporting(E_USER_WARNING);
session_start();
?>
<html>
<head>
<meta http-equiv="Content-Language" content="en-gb">
<meta http-equiv="Content-Type" content="text/html; charset=WINDOWS-1252">
<title>Propertyeagle.co.uk: Search Properties</title>
</head>
<body>
<p><img border="0" src="logo.GIF" >






<font face="Verdana" size="1"> 
<br>


<?php 
$tempflag= $_GET['id'];

if ($tempflag == '1') {
$keywords=$_POST['keywords'];		//keywords
$keywordscriteria=$_POST['R1']; 	//keywords criteria
$minprice=$_POST['minprice'];		//minimum price
$maxprice=$_POST['maxprice'];		//maximum price
$daysposted=$_POST['daysposted'];	//how many days back to search
$resultsortcriteria=$_POST['R2']; 	//criteria used to sort results
$resultsortcriteriab=$_POST['R2']; 	//criteria used to fix problem with checkbox not sticking


//Strip any possibly malicous PHP or HTML code out of all te variables used on this page

$keywords=strip_tags ($keywords);
$minprice=strip_tags ($minprice);
$maxprice=strip_tags ($maxprice);
$daysposted=strip_tags ($daysposted);



Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.