-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmeasurement.php
More file actions
91 lines (83 loc) · 2.77 KB
/
Copy pathmeasurement.php
File metadata and controls
91 lines (83 loc) · 2.77 KB
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php
// Your existing PHP code
error_reporting(0);
@include 'config.php';
@include 'login_check.php';
session_start();
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$cid = $_SESSION['client_id'];
// Check if any required field is empty
$required_fields = [
"collar", "neck_to_shoulder", "sleeve_length", "shoulder_to_shoulder",
"chest", "front_length", "sleeve_cuff", "hem", "waist", "front_rise", "hip", "thigh", "length",
"knee", "inseam", "leg_opening"
];
foreach ($required_fields as $field) {
if (empty($_POST[$field]) and $_POST[$field]!=0) {
echo "Error: $field is empty.";
exit;
}
}
$collar = $_POST["collar"];
$neck_to_shoulder = $_POST["neck_to_shoulder"];
$sleeve_length = $_POST["sleeve_length"];
$shoulder_to_shoulder = $_POST["shoulder_to_shoulder"];
$chest = $_POST["chest"];
$front_length = $_POST["front_length"];
$sleeve_cuff = $_POST["sleeve_cuff"];
$hem = $_POST["hem"];
$waist = $_POST["waist"];
$front_rise = $_POST["front_rise"];
$hip = $_POST["hip"];
$thigh = $_POST["thigh"];
$length = $_POST["length"];
$knee = $_POST["knee"];
$inseam = $_POST["inseam"];
$leg_opening = $_POST["leg_opening"];
$shirt_insert = "UPDATE shirt SET
collar='$collar',
neck_to_shoulder='$neck_to_shoulder',
sleeve_length='$sleeve_length',
shoulder_to_shoulder='$shoulder_to_shoulder',
chest='$chest',
front_length='$front_length',
sleeve_cuff='$sleeve_cuff',
hem='$hem'
WHERE
client_id='$cid'";
$pant_insert = "UPDATE pant SET
waist='$waist',
front_rise='$front_rise',
hip='$hip',
thigh='$thigh',
length='$length',
knee='$knee',
inseam='$inseam',
leg_opening='$leg_opening'
WHERE
client_id='$cid'";
$res_shirt = mysqli_query($conn, $shirt_insert) or die(mysqli_error($conn));
$res_pant = mysqli_query($conn, $pant_insert) or die(mysqli_error($conn));
if ($res_shirt && $res_pant) {
$_SESSION['collar'] = $collar;
$_SESSION['neck_to_shoulder'] = $neck_to_shoulder;
$_SESSION['sleeve_length'] = $sleeve_length;
$_SESSION['shoulder_to_shoulder'] = $shoulder_to_shoulder;
$_SESSION['chest'] = $chest;
$_SESSION['front_length'] = $front_length;
$_SESSION['sleeve_length'] = $sleeve_length;
$_SESSION['hem'] = $hem;
$_SESSION['waist'] = $waist;
$_SESSION['front_rise'] = $front_rise;
$_SESSION['hip'] = $hip;
$_SESSION['thigh'] = $thigh;
$_SESSION['length'] = $length;
$_SESSION['knee'] = $knee;
$_SESSION['inseam'] = $inseam;
$_SESSION['leg_opening'] = $leg_opening;
header('Location: ' . SITEURL . 'client_details.php');
exit;
} else {
echo "Data not inserted";
}
}