Problems With PHP POST

Hi there,

I am running on a new cPanel server installation and I am having some problems with POST data.

Here’s my test POST script:

	public function post_test()
		if ($this->input->post('post_test'))
			echo 'got post';
		echo '<form action="" method="post">';
		echo '<textarea name="live"></textarea>';
		echo '<input type="hidden" name="post_test" value="1">';
		echo '<input type="submit" name="submit" value="Submit">';
		echo '</form>';

The $_POST array is empty when I post this data in textarea[name=live]:

<b>Need Tickets?</b><br>
<b>Booking Now!</b><br><br>

To be announced

The $_POST array populates with data from the form when I post this data (it posts properly):

<b>Need Tickets?</b><br>
<b>Booking Now!</b><br><br>

My question is, why does the entire $_POST array become empty when I post anything in textarea[name=live] beyond the <br><br>? So weird.

Hi Panduola,

Is there some more code that you haven’t shown? How are you checking the value of ‘live’ once the form is submitted?

Doing a var_dump($_POST); reveals array(0){}

Are you using CodeIgniter? Could you try var_dump($this->input->post()); and let me know what you get?

Yes. I have done this as well. The response is bool(false).

If this site is online somewhere, could you share a link to it? I’d like to see the page and check what the browser is actually submitting etc.


Try submitting the two different code samples above.

Right, I’ve tried both variations of the text you mention in your first post and I get the same results you do. Interestingly, when submitting the full text (the one that doesn’t work) the Chrome console reports that the server responds with a 403 error.

I did a quick search and it’s possible that it’s related to a server module called mod_security:

The suggested fix is to add the following lines to your .htaccess file:

<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off

If that works for you, I’d recommend checking with your hosting company if it’s safe to leave it set like that.

Solved! Great. This did the trick. Many thanks!