title: $_POST treeview data
body: <p>I used treeview component from this site <a href="http://wwwendt.de/tech/dynatree/doc/samples.html" rel="nofollow">TreeView</a></p>
  
  <p>(please choose "Embed in forms")</p>
  
  <p>i edited sample source code and saved it to index.php :</p>
  
  <pre><code>&lt;!DOCTYPE&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"&gt;
      &lt;title&gt;Dynatree - Example&lt;/title&gt;
      &lt;script src="../assets/jquery/jquery.js" type="text/javascript"&gt;&lt;/script&gt;
      &lt;script src="../assets/jquery/jquery-ui.custom.js" type="text/javascript"&gt;&lt;/script&gt;
      &lt;script src="../assets/jquery/jquery.cookie.js" type="text/javascript"&gt;&lt;/script&gt;
      &lt;link href="../assets/css/ui.dynatree.css" rel="stylesheet" type="text/css"&gt;
      &lt;script src="../assets/js/jquery.dynatree.js" type="text/javascript"&gt;&lt;/script&gt;
      &lt;!-- (Irrelevant source removed.) --&gt;
      &lt;!-- Add code to initialize the tree when the document is loaded: --&gt;
      &lt;script type="text/javascript"&gt;
      $(function(){
        $("#tree").dynatree({
          checkbox: true,
          // Override class name for checkbox icon, so rasio buttons are displayed:
          //classNames: {checkbox: "dynatree-radio"},
          // Select mode 3: multi-hier
          selectMode: 3,
          children: [
            {title: "Item 1", key: "node1"},
            {title: "Folder 2", isFolder: true, key: "node2",
              children: [
                {title: "Sub-item 2.1", key: "node2.1"},
                {title: "Sub-item 2.2", key: "node2.2"}
              ]
            },
            {title: "Item 3", key: "node3"}
          ]
        });
        $("form").submit(function() {
          // Serialize standard form fields:
          var formData = $(this).serializeArray();
          // then append Dynatree selected 'checkboxes':
          var tree = $("#tree").dynatree("getTree");
          formData = formData.concat(tree.serializeArray());
  
          // and/or add the active node as 'radio button':
          if(tree.getActiveNode()){
            formData.push({name: "activeNode", value: tree.getActiveNode().data.key});
          }
  
          alert("POSTing this:\n" + jQuery.param(formData));
  
          $.post("http://localhost/LearnPHP/Tree/code/action.php", formData);
        });
      });
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body class="example"&gt;
      &lt;h1&gt;Example: Form&lt;/h1&gt;
      &lt;p class="description"&gt;
          This checkbox tree is embedded in a form.
          The [Submit] handler serializes the selected tree nodes as if they were
          standard checkboxes.&lt;br&gt;
          The values are then POSTed to the server (together with the other form
          elements).
      &lt;/p&gt;
      &lt;form action="http://localhost/LearnPHP/Tree/code/action.php" method="POST"&gt;
          &lt;!--&lt;form method="POST"&gt;--&gt;
          Username: &lt;input type="text" name="userName" /&gt;
          &lt;br&gt;
          &lt;textarea name="comment"&gt;&lt;/textarea&gt;
          &lt;br&gt;
          &lt;input type="radio" name="rb1" value="foo" checked&gt; Foo
          &lt;input type="radio" name="rb1" value="bar"&gt; Bar
          &lt;input type="radio" name="rb1" value="baz"&gt; Baz
          &lt;br&gt;
          &lt;input type="checkbox" name="cb1" value="John" checked&gt;John
          &lt;input type="checkbox" name="cb1" value="Paul"&gt;Paul
          &lt;input type="checkbox" name="cb1" value="George"&gt;George
          &lt;input type="checkbox" name="cb1" value="Ringo"&gt;Ringo
          &lt;br&gt;
          &lt;!-- The name attribute is used by tree.serializeArray()  --&gt;
          &lt;div id="tree" name="selNodes"&gt;&lt;/div&gt;
          &lt;input type="submit" value="Send data"&gt;
      &lt;/form&gt;
      &lt;!-- (Irrelevant source removed.) --&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I sent data to action.php (here is my action.php file) :</p>
  
  <pre><code>print_r($_POST);
  </code></pre>
  
  <p>but treeview's data was not printed :</p>
  
  <pre><code>Array ( [userName] =&gt; test [comment] =&gt; testt [rb1] =&gt; foo [cb1] =&gt; John )
  </code></pre>