Codeigniter 3 - Set Flashdata Array issue
This seems more like a code review question (like Alive to Die comments), so I'm not entirely sure what you are needing.  For the most part, your code looks fine.  I have a few things to consider, but they are mainly preferential.  

You could adjust the View output within the form.

&lt;?php 
    for($i=0; $i&lt;$max; $i++) { 
        echo '&lt;label&gt;Username ' . $i . ' &lt;/label&gt;&lt;input type="text" placeholder="username" name="username[' . $i . ']&gt;';
    }
?&gt;


In your Controller, you could also initiate $a and $b differently, as mentioned in this Stack Overflow article: Assign same value to multiple variables.

$a = $b = 1;