Page 1 of 1

session start then redirect [SOLVED]

Posted: Sun Feb 05, 2006 11:22 pm
by khaki_monster
hi again all! with my never ending questions :)

how do i pass some session variables w/ some values using Header() function.

givin some statements:

Code: Select all

session_start();
$_SESSION['id'] = 'ABC';
 // what come next after this line
header("Location: ");
hope you guyz can help me out('as often') :)

cheerz!

Posted: Sun Feb 05, 2006 11:33 pm
by Burrito

Code: Select all

session_start(); 
$_SESSION['id'] = 'ABC'; 
 // what come next after this line 
header("Location: your-real-page.php");
you'll need to make sure you're not sending ANYTHING (including whitespace) to the browser above your header() function.

Posted: Sun Feb 05, 2006 11:52 pm
by khaki_monster

Code: Select all

you'll need to make sure you're not sending ANYTHING (including whitespace) to the browser above your header() function.
could you please elaborate it more :) coz im not tha well experience with some PHP functions...

Code: Select all

session_start(); 
$_SESSION['id'] = 'ABC'; 
header("Location: session_test.php");
session_test.php should have something like:

Code: Select all

<?php

session_start();
$id = $_SESSION['id'];
echo 'Your Session: '.$id;

?>
cheerz!

Posted: Mon Feb 06, 2006 12:05 am
by feyd
your elaboration can be found here: viewtopic.php?t=1157

Posted: Mon Feb 06, 2006 2:09 am
by khaki_monster
tanx guyz! it actually works... but i need to test more!

cheerZ!