Pete Posted October 27, 2013 Share Posted October 27, 2013 Hi folks It seems like there's an issue with using arrays in field names. For example, when I submit this: <input type="text" name="extras[$event->id][$extra->id]" value="1" /> and print the contents of $this->input->post versus printing the contents of $_POST I get different results as below: // print_r($this->input->post) gives me this: WireInputData Object ( [stripSlashes:protected] => [data:protected] => Array ( [extras] => Array ( ) ) ) // Whereas print_r($_POST) gives me this, which is what I want: Array ( [extras] => Array ( [1504] => Array ( [1499] => 1 ) ) ) I'm happy to work with $_POST instead, but wondered if there was a reason why PW's version doesn't do multi-dimensional arrays from input fields? 1 Link to comment Share on other sites More sharing options...
teppo Posted October 27, 2013 Share Posted October 27, 2013 @Pete: this is a bit old, but Ryan has explained it here. In that reply he also says that he'll add support for multidimensional arrays soon.. but as far as I can see, it's still expressly disallowed: https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/core/Input.php#L62. So.. good question Link to comment Share on other sites More sharing options...
Pete Posted October 27, 2013 Author Share Posted October 27, 2013 Cheers teppo - good spot! I... bumped that other topic Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now