i want to use one checkbox for delete data in phpmyadmin. When I tick the checkbox button, it will delete all the data in table based on code preferred by user on dropdown-list. But I don't know how to code it using php since i'm a newbie. Can anyone help me?
I have google but mostly use checkbox to delete one by one file.
<input type="checkbox" name="delete" value="cubadelete.php?deleted=1&id=<?php echo $row->sub_code; ?>"> Remove old version. <br>
this is my code. it is true?
<?php
include('db_connect2.php');
$error="";
$id="";
$sub_code=" ";
$name=" ";
$path=" ";
//check id for delete
if(isset($_REQUEST['delete']))
{
$sql="TRUNCATE TABLE test where sub_code='{$_GET['id']}' ";
$query=mysqli_query($link, $sql);
if($query)
{
{
header('Refresh:0; index.php');
}
}
}
mysqli_close($link);
?>
this is for php file. Thankyou for helping me.
Aucun commentaire:
Enregistrer un commentaire