Can anyone help me work this out? I have an array with a room number associated with fname, lname, etc. I know the number of rooms, and want to fill in the form with textbox where the room is empty, and with the persons name in the room associated with the specific room. This is my code I have come up with that only gives me the table once with the first person, and text boxes in the other rooms. $row=mysql_fetch_array($List); for($i=1;$i<=12;$i++){ echo "<td align='center'>"; if($row['room']!=$i){ echo"$i</td>"; echo"<td align='center'><input type='text' name='lname'></td>"; echo"<td align='center'><input type='text' name='fname'></td>"; } else { echo "$row[room]</td>"; echo "<td align='center'><a href = 'Edit.php?ID=$ID'>" .ucfirst($row[lname])." </a></td>"; echo "<td align='center'><a href='Edit.php?ID=$ID'>".ucfirst($row[fname])."</a> </td>"; }