Sessions Help

They have: 7 posts

Joined: Mar 2004

Hi There

I'm new to this forum and new to PHP. So here i go. I have a form i'm trying to carry 3 different variables over to the next page.

But i keep getting these errors..

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/special1-2-1.php:7) in /home/special1-2-1.php on line 7

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

here is my code:

<?php
session_start
();
if ( isset(
$_POST[\"item\"]) || isset($_POST[\"price\"]) || isset($_POST[\"FRM_3\"])  )
{
   
$_SESSION[\"page1\"] = $_POST[\"item\"];
   
$_SESSION[\"page1\"] = $_POST[\"price\"];
   
$_SESSION[\"page1\"] = $_POST[\"FRM_3\"];
    header(\"location: ./special1-2-2.php\");
}

?>

Can anyone please hlep me! Confused

Greg K's picture

He has: 2,145 posts

Joined: Nov 2003

is this file the /home/special1-2-1.php file?

When I was messing around with session settings, I found that if you didn't start <? right at the first character on the first line, it gave me an error Cannot send session cookie - headers already sent becasue the server already sent out the header information when it encountered something to send to the browser before you gave the command.

-Greg

They have: 7 posts

Joined: Mar 2004

That's Great Thank you so so very much! Laughing out loud

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.