Page 1 of 1

Session variables disappear?

Posted: Fri Jan 07, 2005 6:34 am
by jim_73_mk1
I'm not sure why but my session variables are vanishing! I've got this code snippet below and the signup() function uses the session to add information to the database. When the page is redirected by the header call all the session variables are gone. Why?

Thanks,
Jim

Code: Select all

<?php
if (!signup()) {
  session_destroy;
  echo '<p align="center" class="warning">
    There was a problem processing your signup.  Please try again later.';
} else {
  header("Location:http://somplace.php");
}
?>

Posted: Fri Jan 07, 2005 7:17 am
by harsha
cannot use session_register when you are using $_SESSION and viceversa

if so the unset($_SESSION['name']) ;

and don;t unset($_SESSION); it is meaningless;

Posted: Fri Jan 07, 2005 7:29 am
by Chris Corbyn
Put

Code: Select all

header("Location:http://somplace.php?".SID);
and make sure

Code: Select all

session_start();
is at the top of http://somplace.php other wise your session will end.