How can I add a sub-array structure in my results? $_POST


I managed to solve my own problem. It was a problem with the #tree. I have to set #tree in the parents to true..

So if you want an array with the following structure:

array {
     array(4) {
        array(9) {

I had to configure #tree for the parents (2 here), and not only for the children

['parent']['#tree'] = true
['parent'][1]['#tree'] = true

I figured it out after trying and reading (Archived, but it worked for me ;) )

Tags: Drupal 7 / Forms

Similar questions

D8 | submitForm | Get the $_POST - vars via $form_state or via \Drupal::request()?
On an regular sumbmitForm function, should I fetch the user input via \Drupal::request()->request->get... or is $form_state->getValues(); the better (more saver) way? thx
Drupal form ahah element, problem with empty $_POST
I'm making a module for ubercart. It's nearly finished, but now I'm working on the admin page. I want the admin to be able to add options, like the poll module adds choices. The problem I have is that the admin form is generated through drupal_get_form, which leaves the $_POST empty. $_POST['form_build_id'] seems to be needed to get the form from c...
$_POST undefined from remote server POST
I am writing a Drupal 7 module which is listening for HTTP POST messages to be sent by a 3rd party remote application. For testing I am sending messages using the Firefox Poster extension. If I POST the message, the following code fails to place any value in my local vars (I get 'undefined index'): However, if I send the message using GET, the vars...
Passing $_POST data from page to page in Drupal
Does anyone know how to transfer $_POST data (HTML form data) from one page to another in Drupal? I have two PHP pages I'm including in two different Drupal nodes, but I can't pass POST data between them. Is there an easy way to do this?
drupal_mail - Need to Remove $_POST
I am new to the drupal_mail function and need help. The code I have works, but I want to get rid of the $_POST parameter to limit my security holes. I don't know how to get the posted variables without using the $_POST parameter, and ideally, I would like to single each parameter out to put a custom label on it. Any help would be greatly appreciate...
Drupal 7 - undefined variable _POST error in export_ui
Our Drupal 7 site has suddenly begun generating this error warning: Undefined variable: _POST in require_once() (line 1 of /home/website/public_html/sites/all/modules/ctools/plugins/export_ui/ctools_export_ui.class.php). We hadn't made any changes or updates prior to this happening, which is why it is puzzling, if not worrying. What is also puzzlin...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.