Handling blank columns in PHP table generation from an array
<p>I'm creating a three column table of form fields with the code below. Each row has three columns. If the total number of fields is not a multiple of three then the last row doesn't contain blank form fields in the remaining columns.</p>

<p>How can I amend this to complete the remaining columns with blank form fields?</p>

<pre><code>&lt;?php
$listCount = count($col);

for ($i = 0; $i &lt; $listCount; ++$i) {    
    if($i % 3 == 0) {
        echo '&lt;tr class="list_row"&gt;'; 
    } ?&gt;

    &lt;td&gt;&lt;input type="text" style="width: 190px;" name="inputCol1[]" value="&lt;?php echo $col[$i] ?&gt;" /&gt;&lt;/td&gt;
         
    &lt;?php 
    if($i % 3 == 3) {
         echo '&lt;/tr&gt;'; 
    }
}  
?&gt;
</code></pre>
