How to fill up 2 textboxes out of a list of 5 textboxes with values from MySQL and leave the 3 remaining blank

i am in a jam and need help. Can somebody please help.

On a form, i generate input boxes to upload documents we need from a client. Say, we need the identity card of 2 business partners and 1 partnership agreement.

The while loop below will show 2 textboxes to upload 2 identity card and 1 textbox to upload 1 partnership agreement.

Here is an associative array with a list of documents we need from client. $listDocPourProjet = clients::recupereListDocPourProjet($PROJET_ID);

This is how i generate the inputboxes.

    <?php
        echo '<table width="100%" class="table table-hover" cellpadding="0" cellspacing="0" id="docList">';
        echo '<tbody>';
            $nombreDossier = "";
            $iDossiers = 0;
            while($iDossiers < count($listDocPourProjet))
            {
                $nombreDossier = $listDocPourProjet[$iDossiers]['DOC_NUM'];
                $iDos = 0;
                while($iDos < $nombreDossier)
                {
                    $counte = $iDos+1;
                    echo '<tr>';
                        echo '<td>';
                            echo $listDocPourProjet[$iDossiers]['DOC_NAME'].' '.$counte;
                            echo "<br>";
        ?>                  
                            <input type="text" id="docUpload" name="docfile[]" >
                            <input type="file" id="docUpload" name="docUpload[]" >
        <?php
                        echo '</td>';
                    echo '</tr>';
                $iDos ++;
                }
            $iDossiers ++;
            }
        echo '</tbody>';
        echo '</table>';

    ?>

Example of generated textboxes:

Identity Card:
textbox 1
textbox 2

Partnership Agreement:
textbox 1

Now, say the client has provided 1 identity card and 1 partnership agreement. How can i fill up the textboxes above with the documents already provided and leave the one not provided blank?

Here is the associative array containing the list of documents received from the client, that is, 1 identity card and 1 partnership agreement.

This is what i came up with:

    <?php
        echo '<table width="100%" class="table table-hover" cellpadding="0" cellspacing="0" id="docList">';
        echo '<tbody>';

            $listDocPourProjet = clients::recupereListDocPourProjet($PROJET_ID);

            $doc_list_terminer = clients::recupereListDocClientTerminerPourProjet($CLIENT_PROJET_ID);

            $nombreDossier = "";
            $iDossiers = 0;
            while($iDossiers < count($listDocPourProjet))
            {

                foreach($doc_list_terminer as $eachDocTerminer)
                {
                    if($eachDocTerminer['DOC_ID']==$listDocPourProjet[$iDossiers]['DOC_ID'])
                    {

                        echo $eachDocTerminer['DOC_ID'];
                        echo('<br>');
                        echo $eachDocTerminer['DOC_NOM'];
                        echo('<br>');echo('<br>');

                        echo $listDocPourProjet[$iDossiers]['DOC_ID'];
                        echo('<br>');
                        echo $listDocPourProjet[$iDossiers]['DOC_NOM'];
                        echo('<br>');echo('<br>');echo('<br>');

                    }
                }
                echo('<br>');

                $nombreDossier = $listDocPourProjet[$iDossiers]['DOC_NUM'];
                $iDos = 0;
                while($iDos < $nombreDossier)
                {
                    $counte = $iDos+1;
    ?>              
                    <tr>
                        <td>
    <?php                   
                            echo $listDocPourProjet[$iDossiers]['DOC_NAME'].' '.$counte;
                            echo "<br>";
    ?>                          
                            <input type="text" id="docUpload" name="docfile[<?php echo $listDocPourProjet[$iDossiers]['DOC_ID'] ?>]['doc_id']" style="width:100%;">
                            <input type="file" id="docUpload" name="docUpload[<?php echo $listDocPourProjet[$iDossiers]['DOC_ID'] ?>]['uploadedfile_id']" >
    <?php                       
                        echo '</td>';
                    echo '</tr>';
                $iDos ++;
                }
            $iDossiers ++;
            }
        echo '</tbody>';
        echo '</table>';

    ?>

Thank you for your assistance.