I have a webpage (in php) where the first section of PHP code gets the relevant records.
<?php
session_start();
require_once('Connections/default.php');
if (isset($_POST['command'])){
$_SESSION['Username'] = '';
$_SESSION['Password'] = '';
session_destroy();
} else {
}
if (is_null($_POST['Username'])){
} else {
$_SESSION['Username'] = $_POST['Username'];
}
if (is_null($_POST['Password'])){
} else {
$_SESSION['Password'] = md5($_POST['Password']);
}
$sql = "SELECT * FROM Users WHERE Username LIKE '".$_SESSION['Username']."' AND Password LIKE '".$_SESSION['Password']."'";
$newdefectquery = "SELECT * FROM Defects WHERE Defect_Status LIKE 'New'";
$selectallusers = "SELECT * FROM Users";
$result = $conn->query($sql);
$defects_new = $conn->query($newdefectquery);
$allusers = $conn->query($selectallusers);
?>
This section of the page works correctly and pulls the results (I can see other data on the page.) I then have the following section of code, which contains a drop down menu of all the site's users (So I can assign defects to each user), but only one of the dynamic drop down menus works? It displays every user. (Where I have more than 1 defect, I would like to be able to assign any of them.)
<?php if ($defects_new->num_rows > 0){
while ($defect = $defects_new->fetch_assoc()){ ?>
<table border="1" width="90%">
<tr>
<td colspan="2">
<h2 style="margin:0px; font-size:25px; line-height:25px;">#<?php echo $defect['Defect_ID'] ?> - <?php echo $defect['Title'] ?> - <?php echo $defect['Found_By'] ?></h2>
</td>
</tr>
<tr>
<td width="80%">
<?php echo $defect['Information'] ?>
<br />
<br />
</td>
<td>
<form name="assign<?php echo $defect['Defect_ID'] ?>" method="post" action="index.php">
<select name="Owner">
<?php while ($users = $allusers->fetch_assoc()){ ?>
<option value="<?php echo $users['Username']?>"><?php echo $users['Username'] ?></option>
<?php } ?>
</select>
</form>
</td>
</tr>
</table>
<br />
<br />
<?php }
} else {
echo "There are no new defects. Good job! :)";
}
?>
Here's a picture of what I see. (I've expanded the working drop down)
The second drop down does not expand. It also does not show any options on inspect element.
Please help. Thanks.