Jump to content

$input with multi-dimensional arrays


FlorianA
 Share

Recommended Posts

Hi all,

could it be that input()->post does not cope with multi-dimensional arrays from POST data?

Example data (pasted from Firefox network analysis):

{
	"add[91896][]": [
		"30227",
		"30312"
	],
	"add[89364][]": "30430",
	"nr[91896][30227]": "a",
	"nr[91896][30312]": "b",
	"nr[89364][30430]": "c",
	"nr[91896][30332]": "",
	...
}

My code:

        print "===add=== "; print_r($_POST['add']);
        print "===nr=== "; print_r($_POST['nr']);

        print "===add=== "; print_r(input()->post('add'));
        print "===nr=== "; print_r(input()->post('nr'));

Result:

===add=== Array ( [91896] => Array ( [0] => 30227 [1] => 30312 ) [89364] => Array ( [0] => 30430 ) ) 
===nr=== Array ( [91896] => Array ( [30227] => a [30312] => b [30332] => [30389] => [30364] => [30432] => [30208] => [30403] => ) [89364] => Array ( [30430] => c [30332] => [30350] => [30389] => [30384] => [30432] => [30403] => ) ) 

===add=== Array ( )
===nr=== Array ( ) 

Any ideas what could be wrong?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...