That's a nice try, but it will never work.
The table leftmenulink must have the primary key (probably column named `id`).
Now you should pass that id column to html controls and then read 'em from the post to delete rows in the DB by those keys.
In general, it may look like this (I haven't checked it so it may not work as is, just an idea here):
Code:
<form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
<?php
include("../../database/sqlconnect.php");
$query=mysql_query("SELECT * FROM leftmenulink");
while($query2=mysql_fetch_array($query))
{
echo $query2['links'];
echo '<input type="checkbox" name="links" value="'. $query2['id'] .'"> <br>';
}
?>
<input type="submit" value="remove" name="remove">
</form>
<?php
if(isset($_POST["remove"]) && isset($_POST["links"]))
{
$idsStr= implode( ",", $_POST["links"] );
$remove=mysql_query("DELETE FROM leftmenulink WHERE id IN ( $idsStr )");
if(!$remove)
{
echo "Nothing has removed";
}
}
?>
Bookmarks