In this post, we have shared How To Delete Multiple Selected Rows Using checkbox in PHP without Ajax. normally we have added the button or anchor tag for delete single data. but when we have large data and we will delete the single data, at that time it will take more time. Then at that time, this functionality will helpful.

For discuss, How To Delete Multiple Selected Rows Using checkbox in PHP without Ajax. after then configuration database and fetch the data and also we will have set bootstrap and take the form and table. here pass data into TR and TD tag through 'WHILE' loop and also take checkbox with multiple names in every single row.

When we will have checked the checkbox and then after click on the delete button then the form will be submitted. it will count the number of checkboxes which are checked. it will get the checkbox value using the for loop after then delete data one by one.

See below example of How To Delete Multiple Selected Rows Using checkbox in PHP without Ajax.

 $conn = mysqli_connect($hostname,$username,$password,$database);
	$checkbox = $_POST['check'];
		$del_id = $checkbox[$i]; 
		mysqli_query($conn,"delete from users where id='".$del_id."'");
		$message = "Data Successfully Deleted";
$result = mysqli_query($conn,"select * from users");
<!DOCTYPE html>
	<title>How To Delete Multiple Selected Rows Using checkbox</title>
    <meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="stylesheet" href="">
	<script src=""></script>
	<script src=""></script>
<div class="container">
<div class="row">
	<div class="col-lg-12">
		<?php if(isset($message)) { ?>
		<div class="alert alert-success alert-dismissible">
		  <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>	
		  <strong>Success!</strong> <?php echo $message; ?> </strong>
		<?php } ?>

<form method="post" action="">
	<div class="row">
		<div class="col-lg-12">
			<button type="submit" class="btn btn-danger btn-sm" name="btnDelete">DELETE</button>
	<table class="table table-bordered">
			<th><input type="checkbox" id="checkAll"> <label for="checkAll">Select All</label></th>
			<th>First Name</th>
			<th>Last Name</th>
			<th>Created Date</th>
		while($row = mysqli_fetch_array($result)) {
			<td><input type="checkbox" id="checkItem" name="check[]" value="<?php echo $row["id"]; ?>"></td>
			<td><?php echo $row["id"]; ?></td>
			<td><?php echo $row["first_name"]; ?></td>
			<td><?php echo $row["last_name"]; ?></td>
			<td><?php echo $row["email"]; ?></td>
			<td><?php echo $row["created"]; ?></td>
$("#checkAll").click(function () {
$('input:checkbox').not(this).prop('checked', this.checked);

I have shared demo Button or URL. So you can click on Button or URL and show the demo.

Show Demo