SixPath Posted September 3, 2010 Share Posted September 3, 2010 im trying to make a breadcrumbs feature on my site. this feature is driven using the session variables. My problem here is that.. i just wondering what make the session variables display its own value (not expected value).. this variable name got no similar across the whole site. i just wanna hear what are the possible causes why this happen... thanks Quote Link to comment https://forums.phpfreaks.com/topic/212424-unexpected-session-variable-update/ Share on other sites More sharing options...
SixPath Posted September 3, 2010 Author Share Posted September 3, 2010 In addition with that, the session variable get its "own value" when i refreshes the breadcrumbs page... thanks Quote Link to comment https://forums.phpfreaks.com/topic/212424-unexpected-session-variable-update/#findComment-1106760 Share on other sites More sharing options...
Adam Posted September 3, 2010 Share Posted September 3, 2010 Can you give an example of it's "own value"? Sessions don't really sound like the right solution for breadcrumbs, they're really just suited to data that will last for the session (as the name kind of implies), or data that needs to be carried between a number of pages. Breadcrumbs generally should be generated for that specific page only. What I imagine is happening is that the breadcrumbs are being set on one page (maybe incorrectly set), that is carrying on to the next page and not being overwritten (or incorrectly set again). Though with no code examples or further information on how they're implemented, can't really help you. Quote Link to comment https://forums.phpfreaks.com/topic/212424-unexpected-session-variable-update/#findComment-1106761 Share on other sites More sharing options...
SixPath Posted September 3, 2010 Author Share Posted September 3, 2010 ok here it goes; ORIGIN PAGE: code : $_SESSION[crumbs][src]="newstyle"; //setting session BREADCRUMBS PAGE: code : echo $_SESSION[crumbs][src]; // newstyle > after refresh echo $_SESSION[crumbs][src]; // category Quote Link to comment https://forums.phpfreaks.com/topic/212424-unexpected-session-variable-update/#findComment-1106770 Share on other sites More sharing options...
Adam Posted September 3, 2010 Share Posted September 3, 2010 Could you post the code for the 'breadcrumbs' page? Quote Link to comment https://forums.phpfreaks.com/topic/212424-unexpected-session-variable-update/#findComment-1106771 Share on other sites More sharing options...
SixPath Posted September 3, 2010 Author Share Posted September 3, 2010 <ul> <li><a href="<?php echo SITE_URL?>">Home</a> »</li> <li> <a href="<?php echo SITE_URL?>/<?php echo $_SESSION[crumbs][src]?>.html"> <?php echo str_replace("-"," ",$_SESSION[crumbs][src]); ?></a> » </li> <li><a href="<?php echo SITE_URL?>/products/<?php echo $_GET[prod_id]?>"><?php echo $_GET[prod_id]?></a></li> </ul> Quote Link to comment https://forums.phpfreaks.com/topic/212424-unexpected-session-variable-update/#findComment-1106772 Share on other sites More sharing options...
Adam Posted September 3, 2010 Share Posted September 3, 2010 Okay so this file is included wherever you want the breadcrumbs presumably? Looking at the code there's nothing I can see that would change the value, it must be happening within the file that includes it. Can you post the code of a page where this file is included, and the values are not correct? Quote Link to comment https://forums.phpfreaks.com/topic/212424-unexpected-session-variable-update/#findComment-1106786 Share on other sites More sharing options...
SixPath Posted September 3, 2010 Author Share Posted September 3, 2010 thanks mr adam.. but first of all i would try to check all the session conditions and setting of variables on the breadcrumbs page... there are couple of classes being embedded there.. i will get back here soon as long as i checked the page. and once again thank you.. Quote Link to comment https://forums.phpfreaks.com/topic/212424-unexpected-session-variable-update/#findComment-1106795 Share on other sites More sharing options...
SixPath Posted September 4, 2010 Author Share Posted September 4, 2010 hi mr adam.. i just found out that on the lower portion of the page... my co-worker added a session variables that sets everything session variables into blank each time it detects that the user didnot login. so that was the reason.. and also i found out how to make "breadcrumbs feature" using $_SERVER[HTTP_REFERER] and its was good. thanks Quote Link to comment https://forums.phpfreaks.com/topic/212424-unexpected-session-variable-update/#findComment-1107193 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.