title: How to get multidimensional array from FORM via post, ajax, php, jquery?
body: <p>Please help me to reapair the code. I need array like this from ajax: car1['color of car']['story about car'].
  But I can get only: car1['story about car'].
  I have read a lot of tips, but without success. I am begginer at php.
  Thanks a lot for concrete answer :)</p>
  
  <pre><code>// HTML smaller version
  &lt;form class= "ajax2" action="formInsertCar.php" method="POST"&gt;
      &lt;input type="submit" value="Save All"&gt;
      &lt;div&gt;
          &lt;select name="car1[]" size="1"&gt;
              &lt;?php $opt = new CarOptions;?&gt;
          &lt;/select&gt;
          &lt;textarea name="car1[]"&gt;&lt;/textarea&gt;
       &lt;/div&gt;
      &lt;div&gt;
          &lt;select name="car2[]" size="1"&gt;
              &lt;?php $opt = new CarOptions;?&gt;
          &lt;/select&gt;
          &lt;textarea name="car2[]"&gt;&lt;/textarea&gt;
      &lt;/div&gt;
  &lt;/form&gt;
  
  // JavaScript, ajax for FORM
  $('form.ajax2').on('submit', function() {
      var that = $(this),
      url = that.attr('action'),
      type = that.attr('method'),
      data = {};
  
      that.find('[name]').each(function(index, value) {
          var that = $(this),
          name = that.attr('name'),
          value = that.val();
  
          data[name] = value;
          // here I want to result like: car1['color of car']['story about car'];
          // but I can get only: car1['story about car']
      });
  
      $.ajax({
          url: url,
          type: type,
          data: data,
          success: function(response) {
              $('.success').html(response);
          }
      });
      return false;
  });
  </code></pre>