PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
djcritch
Forum Newbie
Posts: 11 Joined: Thu Mar 20, 2008 5:55 am
Post
by djcritch » Thu Mar 20, 2008 6:01 am
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 ?
Mini
Forum Newbie
Posts: 23 Joined: Mon Dec 04, 2006 4:39 am
Location: Netherlands
Post
by Mini » Thu Mar 20, 2008 6:40 am
Code: Select all
session_start();
foreach ($_GET as $key => $value)
{
$_SESSION[$key] = $value;
}
echo $_SESSION['url'];
hope that helps you.
djcritch
Forum Newbie
Posts: 11 Joined: Thu Mar 20, 2008 5:55 am
Post
by djcritch » Thu Mar 20, 2008 7:20 am
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
Mini
Forum Newbie
Posts: 23 Joined: Mon Dec 04, 2006 4:39 am
Location: Netherlands
Post
by Mini » Thu Mar 20, 2008 7:44 am
The session_start(); should go on top of the page, before you have any output (echo/html).
John Cartwright
Site Admin
Posts: 11470 Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:
Post
by John Cartwright » Thu Mar 20, 2008 8:34 am
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.