RE: [PHP] Trouble with Session var

From: Date: Sat, 02 Aug 2003 23:36:20 +0000
Subject: RE: [PHP] Trouble with Session var
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-158059@lists.php.net to get a copy of this message
DOH! Nevermind, I mis-spelled session_start(). :( -----Original Message----- From: James Johnson [mailto:james@smb-studios.com] Sent: Saturday, August 02, 2003 4:19 PM To: php-general@lists.php.net Subject: [PHP] Trouble with Session var Hello, This one has me stumped. I'm setting a session var to a value returned from a query, then redirecting to another page. I get the following error on the second page: Notice: Undefined index: sv_adCatText On the page that sets the session var, I can do an echo of $HTTP_SESSION_VARS['sv_adCatText'] and it prints the var fine. If I do a var_dump($HTTP_SESSION_VARS); I can see all of the session vars, except this one. Is there a limit or something to the number of Session vars that can be used? I've even tried setting a Session var called "foo" and that doesn't work. Thanks, James Here's the code: First Page: <?php session_start();?> <?php if(isset($_POST['selCat'])){ $as_adCat = addslashes($_POST['selCat']);$HTTP_SESSION_VARS['sv_adCat'] = trim($as_adCat); $id = $_POST['selCat']; mysql_select_db($database_CCB, $CCB); $query_GetCatText = "SELECT category FROM categories WHERE category_id = '$id' ORDER BY category ASC"; $GetCatText = mysql_query($query_GetCatText, $CCB) or die(mysql_error()); $row_GetCatText= mysql_fetch_assoc($GetCatText); $HTTP_SESSION_VARS['sv_adCatText'] = $row_GetCatText['category']; if($HTTP_SESSION_VARS['sv_adCatText'] == "Books"){ header("Location: " . "CreateAdBook.php"); exit; }else{ header("Location: " . "CreateAdNonBook.php"); exit; } } ?> Second Page: <?php session_start();?> <td><?php echo $HTTP_SESSION_VARS['sv_adCatText']; ?></td> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#158059) next »