Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>PHP is capable of creating an array out of multiple inputs with a single name by using square brackets. I am not entirely sure of what you are trying to accomplish, but if there are a dynamic number of rows, you might want to avoid giving each one a unique name. </p> <p>You might consider a naming convention similar to this:</p> <pre><code>&lt;textarea style="width:100%;" name="directTimeStart[]" id="directTimeStart_0"&gt;&lt;/textarea&gt;&lt;/td&gt; &lt;textarea style="width:100%;" name="directTimeEnd[]" id="directTimeEnd_0"&gt;&lt;/textarea&gt;&lt;/td&gt; &lt;textarea style="width:100%;" name="directJob[]" id="directJob_0"&gt;&lt;/textarea&gt;&lt;/td&gt; &lt;textarea style="width:100%;" name="directPlant[]" id="directPlant_0"&gt;&lt;/textarea&gt;&lt;/td&gt; &lt;textarea style="width:100%;" name="directPPE[]" id="directPPE_0"&gt;&lt;/textarea&gt;&lt;/td&gt; &lt;textarea style="width:100%;" name="directMaterials[]" ... &gt;&lt;/td&gt; </code></pre> <p>Which will allow you to completely forget about the numbering on the client side, and shift the task to PHP. In PHP, you will be able to access the first row by using <code>$_GET[directTimeStart][0]</code>, the second row with <code>$_GET[directTimeStart][1]</code>, etc.</p> <pre><code>$count = count($_POST['directTimeStart']); for ($i = 1; $i &lt;= $count; $i++) { $csv .= $_POST[directTimeStart][$i] . ','; $csv .= $_POST[directTimeEnd][$i] . ','; $csv .= $_POST[directJob][$i] . ','; $csv .= $_POST[directPlan][$i] . ','; $csv .= $_POST[directPPE][$i] . ','; $csv .= $_POST[directMaterials][$i] . '\n'; } return $csv; </code></pre>
 

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