Strange HTTP_POST_VARS issues

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
falljer
Forum Newbie
Posts: 5
Joined: Fri Apr 09, 2004 10:15 am
Location: Madison, WI

Strange HTTP_POST_VARS issues

Post 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.
magicrobotmonkey
Forum Regular
Posts: 888
Joined: Sun Mar 21, 2004 1:09 pm
Location: Cambridge, MA

Post by magicrobotmonkey »

change $HTTP_POST_VARS to $_POST
falljer
Forum Newbie
Posts: 5
Joined: Fri Apr 09, 2004 10:15 am
Location: Madison, WI

$HTTP_POST_VARS to $_POST

Post by falljer »

I went ahead and tried using $_POST instead of $HTTP_POST_VARS, same results. Doesn't work any better or worse.
magicrobotmonkey
Forum Regular
Posts: 888
Joined: Sun Mar 21, 2004 1:09 pm
Location: Cambridge, MA

Post by magicrobotmonkey »

Man, that's just weird!
falljer
Forum Newbie
Posts: 5
Joined: Fri Apr 09, 2004 10:15 am
Location: Madison, WI

Post 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!
magicrobotmonkey
Forum Regular
Posts: 888
Joined: Sun Mar 21, 2004 1:09 pm
Location: Cambridge, MA

Post 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??
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post 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 ;)).
falljer
Forum Newbie
Posts: 5
Joined: Fri Apr 09, 2004 10:15 am
Location: Madison, WI

Post 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?
falljer
Forum Newbie
Posts: 5
Joined: Fri Apr 09, 2004 10:15 am
Location: Madison, WI

Post 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.
Post Reply