Displaying individual rows with same key as part of larger associative array using PHP and HTML

I am trying to display data from multiple MySQL tables in individual text fields in an HTML form using PHP. Here are three sample tables from a database, followed by code that I am using to select the data and echo it to text fields in HMTL.

item_id item_title user_id
1 Abc 2
2 Def 4
document_id document_title item_id
1 Ghi 1
2 Jkl 1
3 Mno 1
4 Pqr 2
user_id user_name
1 John Doe
2 Jane Doe
3 James Doe
4 Jan Doe

Here is the code that I am using:

<?php
$sql = "SELECT i.item_title, d.document_title, u.user_name 
       FROM items as i 
       INNER JOIN documents as d
       ON i.item_id = d.item_id
       INNER JOIN users as u
       ON i.user_id = datat.item_number
       WHERE i.item_id = 1;";
    $result = mysqli_query($db_server, $sql);
    while($row=mysqli_fetch_assoc($result))
        {foreach($row as $key=>$value) ${$key}=$value;}
?>
    
    <form method="POST" action="updateItem.php">
    <p><textarea name="item_title"> <?php echo $item_title;?> </textarea></p>
    <p><input type="text" name="user_name" value="<?php echo $user_name?>"/></p>
    <p><input type="text" name="document_title[]" value="<?php echo $document_title?>"/></p>
    <p><input type="text" name="document_title[]" value="<?php echo $document_title?>"/></p>
    <p><input type="text" name="document_title[]" value="<?php echo $document_title?>"/></p>

The problem that I am running into is with the three fields that are supposed to display the document titles. The associate array produces a key=>value combo for these three rows in the document table that all have the same key (document_title). So how can I access these and display these three rows individually in individual fields in the HTML form?

Thank you in advance!