Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If i understand you correctly, here is HTML form example:</p> <pre><code>&lt;form action="" method="post"&gt; &lt;fieldset&gt; &lt;legend&gt;Group 1&lt;/legend&gt; &lt;div&gt; &lt;input type="text" name="groups[0][first_name]" /&gt; &lt;/div&gt; &lt;div&gt; &lt;input type="text" name="groups[0][last_name]" /&gt; &lt;/div&gt; &lt;/fieldset&gt; &lt;fieldset&gt; &lt;legend&gt;Group 2&lt;/legend&gt; &lt;div&gt; &lt;input type="text" name="groups[1][first_name]" /&gt; &lt;/div&gt; &lt;div&gt; &lt;input type="text" name="groups[1][last_name]" /&gt; &lt;/div&gt; &lt;/fieldset&gt; &lt;fieldset&gt; &lt;legend&gt;Group 3&lt;/legend&gt; &lt;div&gt; &lt;input type="text" name="groups[2][first_name]" /&gt; &lt;/div&gt; &lt;div&gt; &lt;input type="text" name="groups[2][last_name]" /&gt; &lt;/div&gt; &lt;/fieldset&gt; &lt;/form&gt; </code></pre> <p>Pay attention to field names, how fields are grupped. After submitting form like this, your $_POST superglobal array will contain $_POST['groups'] array of following structure:</p> <pre><code>Array ( [0] =&gt; Array ( [first_name] =&gt; [last_name] =&gt; ) [1] =&gt; Array ( [first_name] =&gt; [last_name] =&gt; ) [2] =&gt; Array ( [first_name] =&gt; [last_name] =&gt; ) ) </code></pre> <p>You can easily process such data with code like this:</p> <pre><code>foreach ($_POST['groups'] as $group) { $group = array_filter($group); if (!empty($group)) { // do something with group } } </code></pre> <p>This little example loops through all submitted groups. array_filter() function will throw away all empty values from each $group array, and !empty(...) will make sure that $group is not empty.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload