CasperSecurity
<?php
session_start();
include'../../../../../connection/connection.php';
$connection = new createConnection();
$connection->connect();
$section_code = $_REQUEST['section_code'];
$section_name = $_REQUEST['section_name'];
$date = date('Y-m-d');
$userId = $_SESSION['userId'];
$is_active = 'yes';
$select ="SELECT * FROM class WHERE section_name = '$section_name' AND is_active = 'yes'";
$query = mysqli_query($connection->myconn, $select);
$num=mysqli_num_rows($query);
if($num >= 1)
{
$_SESSION['ERROR_MSG'] = "Section Name Already Exist";
$_SESSION['MSG_ALRT'] = "FALSE";
header('location:section.php');
}
else{
$newInsert ="INSERT INTO section(section_code,section_name,created_on,created_by,is_active)
VALUES('$section_code','$section_name','$date','".(int)$userId."','$is_active')";
if(mysqli_query($connection->myconn,$newInsert) === TRUE ){
$_SESSION['ERROR_MSG'] = "Data Inserted Successfully";
$_SESSION['MSG_ALRT'] = "TRUE";
//header('location:../../../../web/home/modules/university/Library/itemtype/item_type.php');
header('location:section.php');
} else {
$_SESSION['ERROR_MSG'] = "Unsuccess";
$_SESSION['MSG_ALRT'] = "FALSE";
//header('location:../../../../web/home/modules/university/Library/itemtype/item_type.php');
header('location:section.php');
}
}
?>