$_GET works but $_POST doesn't

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

wqian94
Forum Newbie
Posts: 8
Joined: Fri Jul 09, 2010 12:04 pm

Re: $_GET works but $_POST doesn't

Post by wqian94 »

it's probably just my machine then
agriz
Forum Contributor
Posts: 106
Joined: Sun Nov 23, 2008 9:29 pm

Re: $_GET works but $_POST doesn't

Post by agriz »

While using POST method, did you try print_r($_REQUEST)

If it returns empty array, we can give up focusing GET method conversion
cpetercarter
Forum Contributor
Posts: 474
Joined: Sat Jul 25, 2009 2:00 am

Re: $_GET works but $_POST doesn't

Post by cpetercarter »

Is it possible that what you are seeing is just the result of caching by the browser. It might happen like this - you run the script with "get" in the form, and test to see the output. You then change "get" to "post" in the <form> tag, and run the script again, testing the output, There are, apparently, no POST variables. But although you think that you have run the script with POST in the form instead of GET, in fact the browser has cached the old version of your script and continues to use it. So, you can find no POST variables. If this makes sense, try clearing the browser cache each time before you run the script.
JakeJ
Forum Regular
Posts: 675
Joined: Thu Dec 10, 2009 6:27 pm

Re: $_GET works but $_POST doesn't

Post by JakeJ »

Have you tested this in different browsers?

Are you testing it on a local server?

Oftentimes, IE will NOT send $_POST data without a privacy policy in place because of browser security.

So if you're uploading it to a place different than local and using IE, it's probably a privacy policy issue.
cpetercarter
Forum Contributor
Posts: 474
Joined: Sat Jul 25, 2009 2:00 am

Re: $_GET works but $_POST doesn't

Post by cpetercarter »

JakeJ's suggestion sounds plausible. See this.
Post Reply