PHP development student management system to delete student information
Create
We made a delete link on the index.php page
<a href='javascript:void(0);' onclick='doDel({$ row['id']})'>Delete</a>
Also used JS warning box to confirm deletion
<script>
function doDel(id) {
if(confirm('Confirm deletion?')) {
window.location='action.php?action=del&id='+id;
}
}
</script>
function doDel(id) {
if(confirm('Confirm deletion?')) {
window.location='action.php?action=del&id='+id;
}
}
</script>
Delete information
Link to the database and delete the related information passed from the delete page The ID information

The code is as follows
<?php
header("content-type:text/html;charset=utf8");
$id = $_GET['id'];
$conn=mysqli_connect("localhost","root","root","study");
mysqli_set_charset($conn,"utf8");
$sql = "delete from stu where id='$id'";
$rw = mysqli_query($conn,$sql);
if ($rw > 0){
echo "<script>alter('删除成功');</script>";
}else{
echo "<script>alter('删除失败');</script>";
}
header('Location: index.php');
?>In this way, our deletion function is completed. We will simplify and integrate all our previous codes
new file
<?php
header("content-type:text/html;charset=utf8");
$conn=mysqli_connect("localhost","root","root","study");
mysqli_set_charset($conn,"utf8");
$id = $_GET['id'];
$sql = "delete from stu where id='$id'";
$rw = mysqli_query($conn,$sql);
if ($rw > 0){
echo "<script>alter('删除成功');</script>";
}else{
echo "<script>alter('删除失败');</script>";
}
header('Location: index.php');
?>
Preview
Clear
Students who have watched this course are also learning
Let's briefly talk about starting a business in PHP
Quick introduction to web front-end development
Large-scale practical Tianlongbabu development of Mini version MVC framework imitating the encyclopedia website of embarrassing things
Getting Started with PHP Practical Development: PHP Quick Creation [Small Business Forum]
Login verification and classic message board
Computer network knowledge collection
Quick Start Node.JS Full Version
The front-end course that understands you best: HTML5/CSS3/ES6/NPM/Vue/...[Original]
Write your own PHP MVC framework (40 chapters in depth/big details/must read for newbies to advance)
















The courseware is not available for download at the moment. The staff is currently organizing it. Please pay more attention to this course in the future~ 