i have come across a something strange which has me stratching my head. i haven't seen it before, so i'm sort of confused:
basically, i have a session variable called "start_num" which gets passsed around from page to page, but which normally is used as "$start_num" - rather than "$_SESSION['start_num']". so far so good. however, the other day i was making some changes, and i found that the number was being reset somehow. after digging around to find the culprit, i discovered that the source was a list, in DESC order, which also defined the same "$start_num". the thing that has me confused is that the session ("$_SESSION['start_num']") is not declared or reset or anything on this page, just the less portable" $start_num".
because the list is in reverse order the number is reset to a low number, but i just cannot figure out why it is being touched at all. (the number coming from the list is passed to the next page via a link where the session may or may not be reset depending on the particular conditions on that page.)
I have changed the "$start_num" name on that page, and it all works fine now. I'm just stumped as to why or how the problem arose and why I haven't seen this behavior before?
thanks. i'll have that a try the next time i come across it... i've already changed my code extensively to solve the problem, so if i come across it again (hopefully not) i'll have a starting point. i was just wondering if anyone had seen this type of behavior before.
some of my pages had been needlessly passing data via links, and i wanted to clean that up by putting it in session variables where i could... and that's, of course, where i ran in to this problem. so i just changed the names of those variables in my lists to something other that "$start_num" and problem solved.
I came across this problem a year or so ago. Recent PHP installations have register_globals disabled by default because it got to be such a pain in the neck....but depending on your host, you may have to disabled it manually using runtime code or a php.ini file.
My problem was a if a post variable - something like $_POST['option'] - was a certain value then spit out a certain HTML string. However, when the page was being built, before I got to that statement, I set the variable $option to a different value and register_globals was the problem. It took me forever to find it but as soon as I turned it off, the problem disappeared.
I've switched careers...
I'm NO LONGER a scientist,
but now a web developer...
awesome.
Bookmarks