Log in

View Full Version : saving session variable passed by form


keymistress
04-19-2005, 01:25 AM
i have a form with say two variables which i pass to page2.php, i retrieve their values like this:

$jobCat = $_REQUEST['jobCat'];
$jobTitle = $_REQUEST['jobTitle'];

and i want to store them as session variables so that when i pass more variables from page2.php to page3.php, i can retrieve $jobCat and $jobTitle at page3.php

i've tried to store them like this:

$_SESSION['jobCat'] = $jobCat;
$_SESSION['jobTitle'] = $jobTitle;

but when i tried to retrieve them like this:

$jobCat = $_SESSION['jobCat'];
$jobTitle = $_SESSION['jobTitle'];

the fields were empty! help please...

Spinball
04-21-2005, 01:05 PM
Does this work?

$_SESSION['jobCat'] = $_REQUEST['jobCat'];
$_SESSION['jobTitle'] = $_REQUEST['jobTitle'];

retrieve them like this:

$jobCat = $_SESSION['jobCat'];
$jobTitle = $_SESSION['jobTitle'];