CasperSecurity
<?php
session_start();
include'../../../../../connection/connection.php';
$connection = new createConnection();
$connection->connect();
// hostel stock indent variables
$indent_no = $_REQUEST['indent'];
$indent_dt = $_REQUEST['date'];
$hostel_id = $_REQUEST['hostel_name'];
$description = $_REQUEST['description'];
//$reqst_status = $_REQUEST['reqst_status'];
$date = date('Y-m-d');
$userId = $_SESSION['userId'];
$is_active = 'yes';
// hostel stock indent item variables
//$hostel_stock_indent_id = $_REQUEST['hostel_stock_indent_id'];
$item_id= $_REQUEST['item'];
$item_qty= $_REQUEST['item'];
//$item_status = $_REQUEST['item_status'];
$select ="SELECT * FROM hostel_stock_indent WHERE indent_no = '$indent_no' AND is_active = 'yes'";
$query = mysqli_query($connection->myconn, $select);
$num=mysqli_num_rows($query);
if($num >= 1)
{
$_SESSION['ERROR_MSG'] = "Item Already Exits";
$_SESSION['MSG_ALRT'] = "FALSE";
header('location:Hostel_Stock_Indent.php');
}
else{
$newInsert ="INSERT INTO hostel(indent_no,indent_dt,hostel_id,description,created_on,created_by,is_active)
VALUES('$indent_no','$indent_dt','$hostel_id','$description','$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/Hostel/Hostel_Stock_Indent/Hostel_Stock_Indent.php');
header('location:Hostel_Stock_Indent.php');
} else {
$_SESSION['ERROR_MSG'] = "Unsuccess";
$_SESSION['MSG_ALRT'] = "FALSE";
//header('location:../../../../web/home/modules/university/Hostel/Hostel_Stock_Indent/Hostel_Stock_Indent.php');
header('location:Hostel_Stock_Indent.php');
}
}
?>