For loop in php and oracle
<p>I have created a checkbox form with attribute medicine name, stock quantity and quantity. User can tick on any medicine name and for quantity user need to fill by themselves. When i tick and insert quantity for the first two row, my data successfully saved into my database. Below is the image for my checkbox form.</p>

<p><img src="https://i.stack.imgur.com/v7hLN.png" alt=" My checkbox form"></p>

<p>But when i tick on the second and the third row,the medicine name successfully insert into database, but the quantity insert into my database is 'null'.</p>

<p><img src="https://i.stack.imgur.com/qSvUd.png" alt="My checkbox form"></p>

<p>checkbox.php</p>

<pre><code>     &lt;input type="checkbox" name="MEDICINE_ID[]" value="&lt;?php echo $row['MEDICINE_ID'] ?&gt;" id="check_item" align="middle" /&gt;
     &lt;/div&gt;&lt;/td&gt;      
     &lt;td align="center"&gt;
       &lt;?php
          echo $row ["MEDICINE_NAME"];
       ?&gt;      
     &lt;/td&gt;

     &lt;td align="center"&gt;
      &lt;?php
         echo $row ["STOCK_QUANTITY"] ," ", $row ["MED_FORM"];
      ?&gt;      
     &lt;/td&gt;

    &lt;td&gt;&lt;label&gt;
    &lt;input name="quantity[]" type="number" max="&lt;?php echo $row['STOCK_QUANTITY'] ?&gt;" min='1' id="quantity" value="" size="1000" /&gt;
    &lt;/label&gt;&lt;/td&gt;

   &lt;?php
      $i++;
   ?&gt;
</code></pre>

<p>checkboxprocess.php</p>

<pre><code>  &lt;?php
     $conn = oci_connect("username", "pass", "orcl");

     $matric_No = $_POST['matric_No'];
     $medicine_ID = $_POST['MEDICINE_ID'];
     $quantity = $_POST['quantity'];
     $dates =  $_POST['dates'];

     $size_medicine=sizeOf($medicine_ID);

        for($i=0;$i&lt;$size_medicine;$i++){       
             $statement="insert into stud_med(quantity,matric_No,medicine_ID,dates) 
             VALUES('$quantity[$i]','$matric_No','$medicine_ID[$i]',to_date('$dates','yyyy-mm-dd'))";
             $state = oci_parse($conn,$statement ); 
             oci_execute($state);   
}
   ?&gt;
</code></pre>