Jump to content

Warning: session_start() [function.session-start]: Cannot send session cookie


PunjabHaker

Recommended Posts

i have 2 files: index.php and s.php

the first lines in both files are:

<?php

session_start();

?>

in the file s.php i got this error:

 

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at D:\Web Design\clothes store\accesories.php:1) in D:\Web Design\clothes store\s.php on line 2

 

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at D:\Web Design\clothes store\accesories.php:1) in D:\Web Design\clothes store\s.php on line 2

 

please help

where am i wrong ?

Link to comment
Share on other sites

no place for swearing, keep your temper controlled. impatience leads to the dark side of the force... (thats me quoting yoda :P)

 

now... this is what your s.php page should look like:

 

<?php
session_start();

echo "<a href='".$_SESSION['backlink']."'>Go Back</a>";
?>

 

and this is what your index.php page should look like:

 

<?php
session_start();

$_SESSION['backlink'] = "index.php";
echo "<a href='s.php'>Go to S.php</a>";
?>

 

with your code make sure there are no whitespaces between the absolute top of your page and <?php and session_start(); must be directly after it.

Link to comment
Share on other sites

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.