/
submitClient.php
executable file
·51 lines (44 loc) · 1.79 KB
/
submitClient.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
<?php
include ('database.php');
session_start();
if(isset($_POST['add_button'])) {
$userid = $_SESSION['id'];
$class=$_POST['class'];
$lastr=$_POST['lastr'];
$firstr=$_POST['firstr'];
$lastc=$_POST['lastc'];
$firstc=$_POST['firstc'];
$company=$_POST['company'];
$oadd=$_POST['oadd'];
$tel=$_POST['tel'];
$email=$_POST['email'];
$status=$_POST['status'];
$notes=$_POST['notes'];
$query1 = "INSERT INTO clients (account_id,classification,representative_first_name,representative_last_name,comaker_first_name,comaker_last_name,company_name,address,status,email,contact_number,notes)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
$stmt = $conn->prepare($query1);
if ($stmt) {
$stmt->bind_param("isssssssssss",$userid, $class, $firstr, $lastr, $firstc, $lastc, $company, $oadd, $status, $email, $tel, $notes);
$stmt->execute();
$stmt->close();
} else {
trigger_error('Statement failed : ' . $stmt->error, E_USER_ERROR);
}
$query2 = "SELECT client_id FROM clients WHERE account_id=? AND classification=? AND representative_first_name=? AND representative_last_name=? AND comaker_first_name=? AND comaker_last_name=? AND company_name=? AND address=? AND status=? AND email=? AND contact_number=? AND notes=?";
$stmt = $conn->prepare($query2);
if ($stmt) {
$stmt->bind_param("ssssssssssss",$userid, $class, $firstr, $lastr, $firstc, $lastc, $company, $oadd, $status, $email, $tel, $notes);
$stmt->execute();
$stmt->bind_result($client_id);
while ($stmt->fetch()) {
echo('<meta http-equiv="refresh" content="0;URL=addcase.php?value='.$client_id.'"/>');
}
$stmt->close();
} else {
trigger_error('Statement failed : ' . $stmt->error, E_USER_ERROR);
}
}
else{
echo $conn->error;
}
?>