Page 1 of 1

Strange HTTP_POST_VARS issues

Posted: Fri Apr 09, 2004 10:15 am
by falljer
I have something I just want to run by everyone, to see if you have any suggestions, or if anybody has run into this:

I'm writing a basic web-based control panel application, using a lot of buttons for navigation. So, on many pages there are several submit buttons in one form tag, all with the same name (for example, lets say "op"), with different values, so that I can check what $HTTP_POST_VARS[op] equals, and run the appropriate function.

Anyway, I got all this working, or so I thought. I gave it to some users to try out, and they were complaining that sometimes when they click on buttions, nothing happens. The same page reloads, but whatever tool was supposed to open doesn't. After debugging further, I found that if I wait several seconds (seems like 20 always works) and click any button on any page, nothing indeed happened consistently.

So, I added some code to all my .php files, to assist me in debugging this problem:

Code: Select all

echo "\n\n<!--  HTTP_POSTVAR INFORMATION:\n";
foreach($HTTP_POST_VARS as $k => $v) &#123;
	echo $k;
	echo " == ";
	echo $v;
	echo "\n";
&#125;
echo "--------------------->\n\n";
Again, I tried running through everything, things are working, but then I waited 20 seconds and clicked a button. Nothing happened, which is what I've found, then I took a look at my source in order to see the debug output:

Code: Select all

<!--  HTTP_POSTVAR INFORMATION:
--------------------->
Of course, when things work, I get something like:

Code: Select all

<!--  HTTP_POSTVAR INFORMATION:
op == Manage Service
service == 3300
--------------------->
So, sometimes, even though I just clicked on a submit button, which obviously tried to post back something or the page wouldn't have refreshed, PHP isn't seeing anything posted back!!

I'm completely confused at this point, and I'm not sure what else I can do. I'm hoping somebody has run into this before.

Posted: Fri Apr 09, 2004 10:27 am
by magicrobotmonkey
change $HTTP_POST_VARS to $_POST

$HTTP_POST_VARS to $_POST

Posted: Fri Apr 09, 2004 11:24 am
by falljer
I went ahead and tried using $_POST instead of $HTTP_POST_VARS, same results. Doesn't work any better or worse.

Posted: Fri Apr 09, 2004 11:48 am
by magicrobotmonkey
Man, that's just weird!

Posted: Fri Apr 09, 2004 11:59 am
by falljer
I know! It shouldn't make a difference, but the management app has been written as a php-nuke module. I also have some Flash on the page header. Is it possible any of these elements are the cause of the problem? The website is located at http://www.terracom.net. I would be happy to create a new account for anyone, if you think you might be able to help with this.

Thanks to magicrobotmonkey for replying, and taking interest!

Posted: Fri Apr 09, 2004 12:20 pm
by magicrobotmonkey
Hmm. I don't really use flash, but that one at the top left of your page seems to go through only once and stop, even though it's set on loop. I don't even know if flash would even be able to interfere with post vars. Also, your forms are set to action="POST" right? Yea I guess they must be if it works at first. It seems like something must be "blocking" the post vars if you wait long enough. Do you have javascript that takes a while to load or run? I con't really think of anyting else, its completely new to me??

Posted: Fri Apr 09, 2004 12:26 pm
by patrikG
Are you using IE and have installed the latest patch? Oddly enough, the patch was buggy and has rendered form-submits useless. Unfortunately, I lost the link, so, unless you can find it somewhere with the search-engine of choice, it remains a rumour (albeit one I trust ;)).

Posted: Fri Apr 09, 2004 1:05 pm
by falljer
I am using IE primarily, but I notice this problem on Netscape and Mozilla as well. That IE patch you're talking about isn't a protocol patch that might affect other winsock apps, is it?

Posted: Fri Apr 09, 2004 1:16 pm
by falljer
UPDATE: I just booted up a Linux workstation, and upgraded Netscape. So far, I cannot repeat the problem under Netscape running on Linux.