Page 1 of 1

How do i echo this?

Posted: Thu Mar 20, 2008 6:01 am
by djcritch
Hi i have set up a php session using GET but having a bit of trouble calling the information, can anyone see what im doing wrong?

heres what ive got:

Code: Select all

 
session_start();
foreach ($_GET as $key => $value)
 {
  $_SESSION[$key] = $value;
 }
 
and to call it i have:

Code: Select all

<?php $_SESSION['url'] echo $_value; ?>

but im guessing this is incorrect ?

Re: How do i echo this?

Posted: Thu Mar 20, 2008 6:40 am
by Mini

Code: Select all

 
session_start();
foreach ($_GET as $key => $value)
{
$_SESSION[$key] = $value;
}
 
echo $_SESSION['url'];
 
hope that helps you. 8)

Re: How do i echo this?

Posted: Thu Mar 20, 2008 7:20 am
by djcritch
ok i have it working now but im getting this warning ? ? ?

any idea how i can get rid of it ? ? ?

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent

Re: How do i echo this?

Posted: Thu Mar 20, 2008 7:44 am
by Mini
The session_start(); should go on top of the page, before you have any output (echo/html).

:D

Re: How do i echo this?

Posted: Thu Mar 20, 2008 8:34 am
by John Cartwright
djcritch wrote:ok i have it working now but im getting this warning ? ? ?

any idea how i can get rid of it ? ? ?

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent
If Mini's suggestion doesn't work, try searching the error. We have discussed this error message hundreds of times.