• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
No $_POST data

I went back to verify the posting thru Zend debug trace and in watching the vars I saw the $HTTP_RAW_POST_DATA was getting set, but $_POST was still empty, that prompted my memory, that this code be an encoding issue.
and sure enough it was.

I use zend to quick enter html so it created
<form action="/index.php/pdf/write" method="POST" enctype="text/plain">
note the enctype...

I changed it to:

and bamo, I get $_POST data.

Sorry for wasting your time, thx for the help

[eluser]Thorpe Obazee[/eluser]
You need not set the enctype unless you're uploading.

I actually copied and pasted that Test controller, and I also am not receiving anything from the print_r($_POST) statement. I've tried it on a couple of projects on my local dev, no luck.

Perhaps an Apache configuration issue, though it's pretty standard setup (just virtual hosts configured and entries in the /etc/hosts file as needed)?


I'm wondering if this might be related to the uri_protocol at all. Can you call on any of your controller methods (other than index) directly from the address bar?

It might also be worth [url="http://validator.w3.org/"]validating your HTML[/url].

Yes, other functions can be accessed using direct urls from the address bar no problem...

It's a pretty standard 1.7.1 installation, a previous 1.6 installation with the above controller works fine. Could certainly be a config parameter. Currently the uri protocol is:

$config['uri_protocol'] = "REQUEST_URI";

Tried AUTO and others and no effect, though I cannot think of what would be stripping out the POST values completely?

I'd suggest going back to basics, and just creating a simple script outside of PHP which will allow you to submit a post value, and then read it back to you. I suspect this will work, in which case, the problem is CodeIgniter (which I doubt), or that your HTML is not valid. Have you tried getting this to work with different browsers?

The test controller code above works on the same server in a CI 1.6.x project, so that eliminates the browser and likely the apache configuration. Next likely suspects is something to do either with CI routes (it's not using any custom routes in the 1.6.x project), an .htaccess issue, or something else I'm missing.

Also checked the httpd error log and not seeing anything else, and no errors being reported other than an empty $_POST array, if either printed at the top of CI's index.php or at the top of the controller it's reaching.

Will also try a clean copy of CI 1.7.1 to narrow things down.

FYI that I've tested it on a couple other servers apart from local and the code is fine, it's just something with 1.7.x and the server configuration I have locally (running MacOSX). Will try and track down the issue in case anyone else is experiencing the same thing.

I'm actually experiencing a very similar problem.

Here is a test form:

<form method="post" action="invest/processInvestInterest">
    <input type="text" name="word" />
    <input type="hidden" name="submitAttempted" value="true" />
    <input type="submit" name="submit" value="go" />

That action goes to this function in my Invest controller (as you'd expect from the 'action' above:

function processInvestInterest()
    echo "foo test <br />";

When I type something like 'blah blah' or '[email protected]' this always returns:

Quote:foo test
Array ( )

The $_POST array is empty! Sad I've tried this in a non-CI environment and the $_POST variables are being sent/received just fine.

Is something wrong with CI?

I ended up using a new/fresh installation of Apache + PHP and it fixed the problem. It's still odd since the problem did not occur with CI 1.6.x, but did with CI 1.7.x. I wasn't able to trace the exact problem, but am certainly happy it's working on the local dev box.

Not sure how we'd go about comparing our installations to track this down? For my setup, was using the MacPorts version of Apache + PHP, switched now to the version that comes with Leopard with the already compiled version of PHP that fits into it (make sure it's not already enabled in the httpd.conf as per the instructions):


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.