logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Coding & Scripting Corner View previous topic :: View next topic
Reply to topic   Topic: $_POST arrays problem...
Author
Carbofos



Joined: 12 Dec 2006
Posts: 2

PostPosted: Tue 12 Dec '06 13:32    Post subject: $_POST arrays problem... Reply with quote

Hi, I'm experiencing a problem with sending arrays with 'post' method. It seems the data are being truncated, for example I have a number of checkboxes with the name "mark[]" and values like "123", "456", "789".
When I submit the form, here's what I get:
Code:
var_dump($_POST);

results in:
Code:
array(1) { ["mark"]=>  array(3) { [0]=>  string(1) "3" [1]=>  string(1) "6" [2]=>  string(1) "9" }}

It seems like only the last character is in the array. I used HTTP header viewer to check what's being sent from my browser and it's ok there, it sends the full data...
I put this 'var_dump' to the very first line of a file so nothing should have a chance to modify data (I've also got 'output_buffering' off in php.ini)
When I do the same on another machine, it's working as expected, of course.
So I think it's either apache or php might be configured incorrectly.

Can anyone give me some directions on where to search? Thanks in advance.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Tue 12 Dec '06 20:33    Post subject: Reply with quote

How does the put look like when you use

Code:

print_r($_POST['mark']);
Back to top
Carbofos



Joined: 12 Dec 2006
Posts: 2

PostPosted: Wed 13 Dec '06 14:18    Post subject: Reply with quote

James Blond
It looks very similar, except there weren't data type names, doing something like:
Code:
echo $_POST['mark'][0]

gives the same one-letter result...

Anyway, what I did is I wiped everything and reinstalled from scratch and now it's working Smile
So I guess the topic may be closed, unless someone else has the same problem and doesn't want to solve it the same way as I did.
Thanks for your help!
Back to top


Reply to topic   Topic: $_POST arrays problem... View previous topic :: View next topic
Post new topic   Forum Index -> Coding & Scripting Corner