Hello PHP Friends,
I think this is just if else statement problem but im kinda lose to it.
The whole code is succesful in deleting the data from database the problem is i wanted to put a script that remind the user if he/she really sure to delete the data. By the way this is the script.
<?php
// connect to the database
include 'Connect.php';
// confirm that the 'student_id' variable has been set
if (isset($_GET['student_id']) && is_numeric($_GET['student_id']))
{
// get the 'student_id' variable from the URL
$student_id = $_GET['student_id'];
// delete record from database
if ($stmt = $mysql->prepare("DELETE FROM student_information WHERE student_id = ? LIMIT 1"))
{
$stmt->bind_param("i",$student_id);
$stmt->execute();
$stmt->close();
}
else
{
echo "ERROR: could not prepare SQL statement.";
}
$mysql->close();
// redirect user after delete is successful
header("Location: Admin_Home.php");
}
else
// if the 'student_id' variable isn't set, redirect the user
{
header("Location: Admin_Home.php");
}
?>
Please help me modify these codes and where to put the missing line/s of codes.