Part of the EllisLab Network
   
2 of 3
2
No $_POST data
Posted: 02 July 2009 02:30 PM   [ Ignore ]   [ # 16 ]  
Summer Student
Avatar
Total Posts:  27
Joined  01-31-2008

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.

Profile
 
 
Posted: 02 July 2009 03:49 PM   [ Ignore ]   [ # 17 ]  
Summer Student
Avatar
Total Posts:  27
Joined  01-31-2008

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.

Profile
 
 
Posted: 04 July 2009 11:09 AM   [ Ignore ]   [ # 18 ]  
Summer Student
Total Posts:  4
Joined  07-04-2009

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" />
</
form>

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

function processInvestInterest()
{
    
echo "foo test <br />";
    
print_r($_POST);
}

When I type something like ‘blah blah’ or ‘myemail@blah.com’ this always returns:

foo test
Array ( )

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

Is something wrong with CI?

Profile
 
 
Posted: 04 July 2009 11:20 AM   [ Ignore ]   [ # 19 ]  
Summer Student
Avatar
Total Posts:  27
Joined  01-31-2008

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):

http://www.entropy.ch/software/macosx/php/

Profile
 
 
Posted: 04 July 2009 11:31 AM   [ Ignore ]   [ # 20 ]  
Summer Student
Total Posts:  4
Joined  07-04-2009

If I change my action (see my post above) to test.php (a file I made outside the CI installation and my site), the $_POST array is populated and displayed appropriately. However, when I send the form to a CI controller for processing, the $_POST data are lost. What’s going on?

Profile
 
 
Posted: 04 July 2009 01:01 PM   [ Ignore ]   [ # 21 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  582
Joined  03-21-2009

bhogg,

There’s a decent windows app called Beyond Compare that does byte by byte comparisons of files and folders.  It might help to track down your offender.

Profile
 
 
Posted: 04 July 2009 07:39 PM   [ Ignore ]   [ # 22 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  633
Joined  12-26-2006
justinm715 - 04 July 2009 11:09 AM

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" />
</
form>

...
...
...

 
I was intrigued to know if it was working on my setup so tried the above and it did not work.
 
My SOLUTION:
The above path quoted is relative, I made it specific and the code works fine.
 
 
 

 Signature 

Joke of the day     (ongoing development site)

My Hippy Trail    Source code   

Latest Project

Profile
 
 
Posted: 05 July 2009 05:58 PM   [ Ignore ]   [ # 23 ]  
Summer Student
Total Posts:  4
Joined  07-04-2009

OMG JOHN I LOVE YOU.

Profile
 
 
Posted: 06 July 2009 11:56 AM   [ Ignore ]   [ # 24 ]  
Summer Student
Avatar
Total Posts:  15
Joined  11-07-2007

Anyone come up with a real solution for this yet?  I set up a new development environment (CodeIgniter 1.6.3) today and am experiencing this same problem.  I set up the following test:

<html>
<
head></head>
<
body>
<?php var_dump($_POST); ?>
<form method="post">
<
input type="text" name="field" value="value" />
<
input type="submit" />
</
form>
<
form method="post" action="/user/post">
<
input type="text" name="field" value="value" />
<
input type="submit" />
</
form>
</
body>
</
html>

Clicking the first submit results in:

array(1) { ["field"]=>  string(5) "value" }

Clicking the second (a CodeIgniter URL) results in:

array(0) { }

The one big change in the environment is our development environments normally run in either FreeBSD or Ubuntu (depending on the day the were built), whereas this one is WAMP (WampServer 2.0h).

Profile
 
 
Posted: 06 July 2009 07:16 PM   [ Ignore ]   [ # 25 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  633
Joined  12-26-2006
justinm715 - 05 July 2009 05:58 PM

OMG JOHN I LOVE YOU.

 
You made me blush smile
 
‘glad to be of help.
 
Stick with CI and you will be well rewarded.
 
 
 

 Signature 

Joke of the day     (ongoing development site)

My Hippy Trail    Source code   

Latest Project

Profile
 
 
Posted: 06 July 2009 07:22 PM   [ Ignore ]   [ # 26 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  633
Joined  12-26-2006
DiRN - 06 July 2009 11:56 AM

Anyone come up with a real solution for this yet?  I set up a new development environment (CodeIgniter 1.6.3) today and am experiencing this same problem.  I set up the following test:

...
...
...

Can you drop the following code into your view and let us know the results:

<?= 'getcwd() === '  .getcwd() ?>

 
 

 Signature 

Joke of the day     (ongoing development site)

My Hippy Trail    Source code   

Latest Project

Profile
 
 
Posted: 06 July 2009 07:27 PM   [ Ignore ]   [ # 27 ]  
Summer Student
Avatar
Total Posts:  15
Joined  11-07-2007

I will try it when I get to the office tomorrow.

Here’s what little other information I have.  As best I can tell, everything not involving a POST is working.  And User::post() looks as follows:

function post() { var_dump($_POST); }
Profile
 
 
Posted: 07 July 2009 09:27 AM   [ Ignore ]   [ # 28 ]  
Summer Student
Avatar
Total Posts:  15
Joined  11-07-2007
getcwd()
returns
C:\wamp\www
Profile
 
 
Posted: 07 July 2009 09:09 PM   [ Ignore ]   [ # 29 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  633
Joined  12-26-2006
DiRN - 07 July 2009 09:27 AM
getcwd()
returns
C:\wamp\www

 
My setup is CodeIgniter 1.71 on WAMP for Windows XP. I notice your CI version and FreeBSD or Ubuntu setup is different.
 
Anyway I introduced a two more form actions, tested and reckon the easiest is to use CodeIgniter’s built in form class. (don’t forget to load the libraries).

// Test 1
   
<?php echo form_open('joke/test_form'); ?>

// Test 2
   
<form method="post">

// Test 3
   
<form method="post" action="joke/test_form">

//Test 4
   
<form method="post" action="/joke/test_form">

 
 

 Signature 

Joke of the day     (ongoing development site)

My Hippy Trail    Source code   

Latest Project

Profile
 
 
Posted: 09 July 2009 08:13 AM   [ Ignore ]   [ # 30 ]  
Summer Student
Avatar
Total Posts:  15
Joined  11-07-2007

So my problem ended up not being CodeIgniter but WAMP.  I didn’t realize that WAMP didn’t enable mod_rewrite by default.  Enabling that did the trick.

Profile
 
 
   
2 of 3
2
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 819, on March 11, 2010 11:15 AM
Total Registered Members: 120562 Total Logged-in Users: 32
Total Topics: 126613 Total Anonymous Users: 1
Total Replies: 665591 Total Guests: 304
Total Posts: 792204    
Members ( View Memberlist )