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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
<?php
include_once '../include/DBConnect.php'; //$score = "1"; if ($_POST) { $score = $_POST['Rate1']; $score++; $score2 = $_POST['Rate2']; $score2++; //'campus'; //check box //'programs'; //check box //'subjects'; //check box
$position = $_POST['Position_id']; $status = $_POST['Status']; $join_date = $_POST['Join_date']; $registration_date = $_POST['Registration_date']; $last_name = $_POST['Last_name']; $first_name = $_POST['First_name']; $zh_name = $_POST['Zh_name']; $gender = $_POST['Gender']; $dob = $_POST['Dob']; $tel = $_POST['Tel']; $mobile = $_POST['Mobile']; $email = $_POST['Email']; $address = $_POST['Address']; $refer_by = $_POST['Refer_by']; $salary = $_POST['Salary']; $rate1 = $_POST['Rate1']; $rate2 = $_POST['Rate2']; $rate3 = $_POST['Rate3']; $rate4 = $_POST['Rate4']; $rate5 = $_POST['Rate5']; $rate6 = $_POST['Rate6']; $rate6_other = $_POST['Rate6_other']; $remarks = $_POST['Remarks']; $working_mode = $_POST['Working_mode']; $currentStaff;
date_default_timezone_set("Hongkong"); $today = date("Y-m-d H:i:s"); $createby = 0; $actived = 1; $deleted = 0;
$sth = $dbh->prepare("INSERT INTO `staff`(`createby`, `createdate`, `lastupby`, `lastupdate`, `actived`, `deleted`, `position_id`, `status`, `join_date`, `registration_date`, `last_name`, `first_name`, `ch_name`, `gender`, `date_of_brith`, `home_tel`, `mobile`, `email`, `address`, `refer_by`, `salary`, `rate1`, `rate2`, `rate3`, `rate4`, `rate5`, `rate6`, `other_rate`, `remarks`, `working_mode`) VALUES ($createby,'$today',$createby,'$today',$actived,$deleted,'$position','$status','$join_date','$registration_date','$last_name','$first_name','$zh_name','$gender','$dob','$tel','$mobile','$email','$address','$refer_by','$salary','$rate1','$rate2','$rate3','$rate4','$rate5','$rate6','$rate6_other','$remarks','$working_mode')"); $sth->execute(); $message; if ($sth) $message = "1 record inserted"; else $message = $sth->errorInfo(); $sth = $dbh->prepare("SELECT `staff_id` FROM `staff` WHERE `createdate` = '$today' AND `last_name` = '$last_name'"); $sth->execute(); while ($ResultSet = $sth->fetch(PDO::FETCH_ASSOC)) { $currentStaff = $ResultSet['staff_id']; }
$Array = array( "1" => $message, "2" => $currentStaff, "3" => $score * 3, "4" => $score * 4, "5" => $score2 * 5 ); $Arrays[] = $Array; } echo json_encode($Array); ?>
|