So I am making this website and i got some data in my database. The data is read automatically with php into a table. Every table row also gets automatically a checkbox. Now I want to check the checkbox and then press delete and it deletes the checked data out of the database. Any ideas how?
Here is my code:
<table width="600" border="1" cellpadding="1" cellspacing="1">
<tr>
<th>Username</th>
<th>Paswoord</th>
<th>Delete</th>
</tr>
<?php
while($user = mysql_fetch_assoc($records)){
echo "<tr>";
echo "<td>".$user['UserName']."</td>";
echo "<td>".$user['Pass']."</td>";
echo "<td> <input type='checkbox' name='checkbox' value='checked'</td>";
echo "</tr>";
}
?>
</table>
<form method= "POST" action="deleteuser.php">
<input type="submit" name="delete" value="DELETE USERS">
</form>
this is the code in my delete user.php
$checked = $_POST['checkbox'];
if($_POST['checkbox'] == "checked"){
echo "SUCCEEEEEEES";
}
Aucun commentaire:
Enregistrer un commentaire