session start then redirect [SOLVED]

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

Post Reply
User avatar
khaki_monster
Forum Commoner
Posts: 73
Joined: Tue Oct 11, 2005 12:36 am
Location: Philippines
Contact:

session start then redirect [SOLVED]

Post 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!
Last edited by khaki_monster on Mon Feb 06, 2006 3:32 am, edited 1 time in total.
User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post 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.
User avatar
khaki_monster
Forum Commoner
Posts: 73
Joined: Tue Oct 11, 2005 12:36 am
Location: Philippines
Contact:

Post 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!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

your elaboration can be found here: viewtopic.php?t=1157
User avatar
khaki_monster
Forum Commoner
Posts: 73
Joined: Tue Oct 11, 2005 12:36 am
Location: Philippines
Contact:

Post by khaki_monster »

tanx guyz! it actually works... but i need to test more!

cheerZ!
Post Reply