-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsaveform.php
57 lines (42 loc) · 1.34 KB
/
saveform.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
include('connection.php');
include('logic.php');
?>
<?php
session_start();
if (isset($_SESSION['eventuser'])) {
$sesname = ucwords($_SESSION['eventuser']);
} else {
echo "session is not available";
}
$tableName = "visitors";
$LastSaveID = getID($tableName);
$getVinfo = $_POST;
//print_r(ucwords($getVinfo['name']));
$vname = ucwords($getVinfo['name']);
$vdesg = ucwords($getVinfo['desg']);
$vcname = ucwords($getVinfo['cname']);
$vdate = $getVinfo['today_date'];
$vtype = $getVinfo['visitor_type'];
$vsysname = $getVinfo['sysname'];
$vzero = "00";
$vchar = substr($vtype, 0, 2);
$newbarcode = $vchar . $vzero . $LastSaveID + 1;
$barArray = array("barcode" => $newbarcode);
function saveForm()
{
//name=pkcha&desg=co&cname=&today_date=29-10-2022 22:20&visitor_type=delegate&sysname=yahma
global $getVinfo;
global $dbConn, $newbarcode, $vname, $vdesg, $vcname, $vdate, $vtype, $sesname, $vsysname, $barArray;
$query = "INSERT INTO visitors (`barcode`, `name`, `designation`, `company`, `date`, `type`, `creator_name`,`systemname`) VALUES ('$newbarcode', '$vname', '$vdesg', '$vcname', '$vdate', '$vtype', '$sesname','$vsysname')";
$data = mysqli_query($dbConn, $query);
if ($data) {
return $newbarcode;
} else {
return 0;
}
$dbConn->close();
}
$saveInfo = saveForm();
echo $saveInfo;
?>