Good morning everybody I made a table in html that contains users and the select box contains profiles. I want to assign every users profile in database according to the profile selected in html. My table in html contains checkbox next to every user. I want every user that is checked to be assigned.
<form action="PHP/modifier.php" method="POSt">
<table>
<thead>
<tr>
<th><input type="checkbox" id="checker" name="all"></th>
<th>Username</th>
<th>Nom</th>
<th>Prenom</th>
</tr>
</thead>
<?php
$query="SELECT Username,Nom,Prenom from user";
$result = mysql_query($query);
$num = mysql_num_rows($result);
for ($i = 0; $i < $num; $i++){
$row =mysql_fetch_array($result);
$Username = $row['Username'];
$Nom = $row['Nom'];
$Prenom = $row['Prenom'];
echo "<tr id='row'>";
echo "<td><input type='checkbox' id='check' name='check'".$Username."></td>";
echo"<td>".$Username."</td>";
echo "<td>".$Nom."</td>";
echo "<td>".$Prenom."</td>";
echo "<td><div id='MAJ'>";
echo "</div></td>";
echo "</tr>";
}
?>
<h2>Selectionner l'utilisateur et le profile</h2>
<select name="profile" id="profilez" required>
<option>Injecteur</option>
<option>Utilisateur</option>
<option>Administrateur</option>
<option>Utilisateur superieur</option>
<input type="submit" value="Associer">
</form>
In the modifer.php I want to make update function to update users but how to get information from checked cases in the html table?
I already wrote this
<?php
include "functions.php";
$profile=$_POST['profile'];
$Username=$_POST['Username'];
$query="UPDATE user SET profile = '$profile' WHERE Username = '$Username' " ;
?>
I don't know how to do it. thank you so much and sorry for my bad english.