variable_get/set not working right I am using drupal 6. I have a variable in a function which I saved with variable_set. I called variable_get in a different function and it keeps giving me the default. Why wont it save the variable? I know that the variable has a value because its used in sql query.

here's my set:

    $staff_action = $_GET['staff_action'];
$first_name = $_GET['first_name'];
variable_set('first_name', $first_name);
$last_name = $_GET['last_name'];
variable_set('last_name', $last_name);
$email = $_GET['email'];
variable_set('email', $email);
drupal_set_message($email . " in first function");


here's my get in second function:

$first_name = $_GET['first_name'];
$last_name = $_GET['last_name'];
$email = variable_get('email', 'none found');
drupal_set_message($email . " in second function");
In your code where you are setting the value move the last line above variable_set() function

Change this code:

 $staff_action = $_GET['staff_action'];
$first_name = $_GET['first_name'];
variable_set('first_name', $first_name);
$last_name = $_GET['last_name'];
variable_set('last_name', $last_name);
$email = $_GET['email'];
variable_set('email', $email);
drupal_set_message($email . " in first function");


To this:

 $staff_action = $_GET['staff_action'];
$first_name = $_GET['first_name'];
variable_set('first_name', $first_name);
$last_name = $_GET['last_name'];
variable_set('last_name', $last_name);
$email = $_GET['email'];
drupal_set_message($email . " in first function");
variable_set('email', $email);


Then it should work.