I have an html table with a checkbox list on one of the columns. I'd like for the checkbox to be inside a dropdown. I am looking to use only php and no JS or Ajax to do so.
echo"
<td>
<form method='post'>
Select user roles<br/>
<input type='hidden' name='user_id' value=".$row["user_id"].">
";
for ($a = 1; $a <= $count ; $a++){
$new_sql = "SELECT role_id from users_roles, users WHERE users_roles.user_id = '".$row["user_id"]."' AND users_roles.role_id = '" . $a . "' GROUP BY users_roles.user_id";
$checked_or_not = mysqli_query($connect, $new_sql);
if ($checked_or_not->num_rows != 0){
echo "<input type='checkbox' checked name='techno[]' value='$a' />" .$roles[($a-1)]. "<br>";
}
else if ($checked_or_not->num_rows == 0){
echo "<input type='checkbox' name='techno[]' value='$a' />" .$roles[($a-1)]. "<br>";
}
}
echo "
<button class='btn btn-primary' type='submit' name='checkSubmit' >Submit</button>
</form>
</td>
";
Aucun commentaire:
Enregistrer un commentaire