error_reporting(E_ALL);
ini_set('display_errors', '1');
<?php
session_start();
include("connection.php");
include("functions.php");
// Check connection
if($con === false){
die("ERROR: Could not connect. " . mysqli_connect_error());
}
if(isset($_POST['d_name'])){
if(isset($_POST['manner_death'])){
if(isset($_POST['place_death'])){
if(isset($_POST['nok'])){
if(isset($_POST['rel_nok'])){
if(isset($_POST['morgue_att'])){
if(isset($_POST['tag_num'])){
if(isset($_POST['treatment']))
// Escape user inputs for security
$d_name = mysqli_real_escape_string($con, $_REQUEST['d_name']);
$manner_death = mysqli_real_escape_string($con, $_REQUEST['manner_death']);
$place_death = mysqli_real_escape_string($con, $_REQUEST['place_death']);
$nok = mysqli_real_escape_string($con, $_REQUEST['nok']);
$rel_nok = mysqli_real_escape_string($con, $_REQUEST['rel_nok']);
$morgue_att = mysqli_real_escape_string($con, $_REQUEST['morgue_att']);
$tag_num = mysqli_real_escape_string($con, $_REQUEST['tag_num']);
$treatment = mysqli_real_escape_string($con, $_REQUEST['treatment']);
// Attempt insert query execution
$sql = "INSERT INTO data (d_name, manner_death, place_death, nok, rel_nok, morgue_att, tag_num, treatment) VALUES ('$d_name', '$manner_death', ','$place_death','$nok','$rel_nok', '$morgue_att','$tag_num','$treatment')";
}else
if(mysqli_query($con, $sql)){
echo "Records added successfully.";
}
{
echo "ERROR: Could not able to execute $sql. " . mysqli_error($con);
// Close connection
mysqli_close($con);
}
?>