http://localhost/del.php?$id=$row[Id]
this is showing on server side
My code is
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<br>
<a class="btn btn-info" href="insert.php">Back to Home</a><br><br>
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "registrationform";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT * FROM registrationdb";
$result = $conn->query($sql);
echo "<table border='1'>
<tr>
<th>Id</th>
<th>Name</th>
<th>Fathername</th>
<th>Mothername</th>
<th>Address</th>
<th>Email</th>
<th>Birthday</th>
<th>Religion</th>
<th>Nationality</th>
<th>Gender</th>
<th>Action</th>
</tr>";
foreach($result as $row)
{
echo "<tr>";
echo "<td>" . $row['Id'] . "</td>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['fathername'] . "</td>";
echo "<td>" . $row['mothername'] . "</td>";
echo "<td>" . $row['address'] . "</td>";
echo "<td>" . $row['email'] . "</td>";
echo "<td>" . $row['birthday'] . "</td>";
echo "<td>" . $row['religion'] . "</td>";
echo "<td>" . $row['nationality'] . "</td>";
echo "<td>" . $row['gender'] . "</td>";
echo "<td>" . '<a class="btn btn-warning" href="del.php?$id=$row[Id]">Delete</a>'. '<a class="btn btn-success"href="update.php">Edit</a>'."</td>";
echo "</tr>";
}
echo "</table>";
$conn->close();
?>
</body>
</html>
//deleting data
<?php
include_once('show.php');
$id="";
$name="";
$fathername="";
$mothername="";
$address="";
$birthday="";
$age="";
$email="";
$religion="";
$nationality="";
$gender="";
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "registrationform";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// keep track post values
// sql to delete a record
$sql = "DELETE FROM registrationdb WHERE Id='$id'";
if ($conn->query($sql) === TRUE) {
echo "Record deleted successfully";
} else {
echo "Error deleting record: " . $conn->error;
}
$conn->close();
?>