Jump to content

Field names using arrays


Pete
 Share

Recommended Posts

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?

  • Like 1
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...