Here is my query:
$sql = "SELECT * FROM employee";
$query = "SELECT * FROM employeerole ORDER BY role_id";
$result = mysqli_query($link, $sql);
$result1 = mysqli_query($link, $query);
<?php
while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
?>
<tr>
<td><?php echo $row["id"]; ?></td>
<td><?php echo $row["first_name"]; ?></td>
<td><?php echo $row["last_name"]; ?></td>
<td><?php echo $row["username"]; ?></td>
<td><?php echo $row["role"]; ?></td>
<td>
Here is my code that includes a dropdown box in a table cell however, the data in the dropdown box only appears in the first row of the table (as shown in screenshot below).
Has this got something to do with the loop?
<form action ="change.php">
<select id="role" class="" onchange="this.form.submit()">
<?php while ($line = mysqli_fetch_array($result1, MYSQL_ASSOC)) { ?>
<option value="<?php echo $line['role_id']; ?>"><?php echo $line['role_name']; ?></option>
<?php } ?>
</select>
</form>
</td>
<td><input type="button" onclick="ConfirmDelete()" value="Delete account"</td>
</tr>
<?php } ?>
Screen shot of the table: