first commit
This commit is contained in:
37
old/CONTENT/POST_ACTION/gv_create_ac.php
Normal file
37
old/CONTENT/POST_ACTION/gv_create_ac.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
if(isset($_POST["ac_type"]) && isset($_POST["ac_name"]) && $_POST["ac_name"]!=""){
|
||||
|
||||
$ca["ac_type"]=$_POST["ac_type"];
|
||||
$ca["ac_name"]=$_POST["ac_name"];
|
||||
$ca["ac_phone"]=$_POST["ac_phone"];
|
||||
$ca["ac_mail"]=$_POST["ac_mail"];
|
||||
$ca["ac_address"]=$_POST["ac_address"];
|
||||
$ca["ac_no"]="GV".$_POST["ac_type"].date("Ymd");
|
||||
//GC_new_entry($ca);
|
||||
|
||||
|
||||
|
||||
$conn = new mysqli($GLOBALS['host'], $GLOBALS['user'], $GLOBALS['pass'], $GLOBALS['db']);
|
||||
|
||||
if ($conn->connect_error) die("Connection failed: " . $conn->connect_error);
|
||||
|
||||
mysqli_set_charset($conn,"utf8");
|
||||
$stmt = $conn->prepare("INSERT INTO ".$GLOBALS['arif_ac']." (`AA_ACTYPE`,`AA_NAME`, `AA_PHONE`, `AA_EMAIL`, `AA_ADDRESS`) VALUES (?, ?, ?, ?, ?)");
|
||||
$stmt->bind_param("sssss" ,$ca["ac_type"],$ca["ac_name"],$ca["ac_phone"],$ca["ac_mail"],$ca["ac_address"]);
|
||||
|
||||
if($stmt->execute()){
|
||||
$lid=$conn->insert_id;$ca["ac_no"]=$ca["ac_no"].$lid;
|
||||
if($conn->query("UPDATE `".$GLOBALS['arif_ac']."` SET `AA_ACNO` = '".$ca["ac_no"]."' WHERE `AA_ID` =".$lid.";"))
|
||||
$GLOBALS['alert_info']= '<div class="alert alert-dismissible alert-info">
|
||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
||||
<strong>Yes!</strong> Entry Saved successfully </div>';
|
||||
}else{
|
||||
$GLOBALS['alert_info']= '<div class="alert alert-dismissible alert-danger">
|
||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
||||
<strong>Sorry!</strong> Unable to process db</div>';
|
||||
}
|
||||
$stmt->close();
|
||||
|
||||
$conn->close();
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user