Home > Software design >  Why is the POST data not sent when text in textarea goes over a certain limit?
Why is the POST data not sent when text in textarea goes over a certain limit?

Time:02-10

I am trying to send the contents of a music review from one page to the other via a POST request. The form for the review contains a textarea field with a character limit of 9900 (the database has a character limit of 10000 for the review):

<textarea name='review_text' cols='200' rows='10' maxlength='9900' placeholder='Reviewtext' required></textarea>

Now, if I paste an example text of length 342 characters into the review textarea, everything is okay and I can read the POST parameters and submit them to the database:

Musik ist sehr abgefahrene elektronische Musik, sie hat auch mit FKA twigs, RALIA, Björk, Shygirl, Kanye West und SOPHIE kollaboriert, also ist Teil dieser Weird Leftfield Gang.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

However, as soon as the character count hits 343, NONE of the POST parameters are sent through to the next page:

Musik ist sehr abgefahrene elektronische Musik, sie hat auch mit FKA twigs, RALIA, Björk, Shygirl, Kanye West und SOPHIE kollaboriert, also ist Teil dieser Weird Leftfield Gang.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

As far as I can see, there is no setting in apache limiting the amount of characters in a POST request. Also, when I view the page with the web developer tools, I can see the parameters, but the page that I am sending it too can't read them. What am I doing wrong?

EDIT: This is the code that I use to get the parameters. As I said, none of the values are retrieved if the length of the text area text it longer than 342 characters, but all of them are in the other case.

$festival_name = $_POST["festival"];
$edition_year = $_POST["edition"];
$artist = $_POST["artist"];
$review_text = $_POST["review_text"];
$category = $_POST["category"];
$song = $_POST["song"];
$link = $_POST["link"];
$date = date('Y-m-d');

CodePudding user response:

I solved it on my own. The problem seems to be the configured value for post_max_size in php. I set it to 20MB on a whim, and it worked. I didn't think that this is the problem, since 342 characters is a long way away from even 1MB, but somehow POST requests seem to get quite big.

EDIT: The change I made in my .htaccess file:

php_value post_max_size 20M
  • Related