CasperSecurity
<?php
session_start();
include '../../connection/connection.php';
$brand_short_name = $_REQUEST['brand_short_name'];
$brand_name = $_REQUEST['brand_name'];
$user_id = $_SESSION['USER_ID'];
$date = date("Y-m-d");
$is_active = 'yes';
if(!empty($brand_name)){
$db_handle = new DBController();
$newInsertt = $db_handle->numRows("SELECT * FROM brand WHERE brand_name = '$brand_name'");
if($newInsertt >= '1'){
$_SESSION['ERROR_MSG'] = "Brand Already Exist";
$_SESSION['MSG_ALRT'] = "FALSE";
header('location:../../../web/home/modules/setup/brand/brandgrid.php');
}else{
$db_handle = new DBController();
$newInsert = $db_handle->tableinsert("INSERT INTO brand (brand_short_name,brand_name,created_on,created_by,is_active)
VALUES ('$brand_short_name','$brand_name','$date','$user_id','$is_active')");
if($newInsert == TRUE){
$_SESSION['ERROR_MSG'] = "Success";
$_SESSION['MSG_ALRT'] = "TRUE";
header('location:../../../web/home/modules/setup/brand/brandgrid.php');
}else{
$_SESSION['ERROR_MSG'] = "Unsuccess";
$_SESSION['MSG_ALRT'] = "FALSE";
header('location:../../../web/home/modules/setup/brand/brandgrid.php');
}
}
}
?>