how to convert form values which is in a loop, into an array in php
<pre><code>&lt;?php 
    $question = array();
    $answer   = array();
    for($i=1; $i&lt;=5; $i++) {
?&gt;
&lt;div class="container"&gt;
    &lt;form action="" method="post"&gt;
        &lt;div class="form-group"&gt;
            &lt;label&gt;Question No: &lt;?php echo $i; ?&gt;&lt;/label&gt;
            &lt;?php echo "&lt;input type='text' class='form-control' name='qu[$i]'&gt;&lt;br/&gt;";
            echo "&lt;lable&gt;Answer: &lt;/lable&gt;";
            echo "&lt;input type='text' class='form-control' name='ans[$i]'&gt;&lt;br&gt;";?&gt;
        &lt;/div&gt;
    &lt;/form&gt;
&lt;/div&gt;
&lt;?php } ?&gt;
&lt;center&gt;&lt;button name='submit' class='btn btn-primary btn-home' style="width: 200px;"&gt;Submit&lt;/button&gt;&lt;/center&gt;
</code></pre>

<p>Here is my code, I want to get all data which is entered in this form. But as a array. After submit the form, this form will collect the values from a loop, so I have to collect values from this loop and convert those to an array.</p>