-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflaw_page.php
executable file
·97 lines (79 loc) · 3.52 KB
/
flaw_page.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
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
92
93
94
95
96
97
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Flaw Page</title>
<link rel="stylesheet" href="globalUsage/style.css" class="css">
</head>
<body>
<h1>Flaw Page</h1>
<?php
require 'globalUsage/db.php';
$order_id = $_POST['order_id'];
$product_id = $_POST['product_id'];
$product_type = $_POST['product_type'];
$state = $_POST['state'];
if(isset($_POST['flaw_type'])){
$flaw_type = $_POST['flaw_type'];
} else $flaw_type = "";
if(isset($_POST['severity'])){
$severity = $_POST['severity'];
}else $severity = "";
?>
<div class="flaw_buttons">
<div class="button_block">
<button onclick="autoComplete()" class="form_button" id = "flaw_type_button" value = "scratch">Scratch</button>
<button onclick="autoComplete()" class="form_button" id = "flaw_type_button" value = "painting">Painting</button>
<button onclick="autoComplete()" class="form_button" id = "flaw_type_button" value = "robustness">Robustness</button>
<button onclick="autoComplete()" class="form_button" id = "flaw_type_button" value = "electricity">Electricity</button>
</div>
<div class="button_block">
<button onclick="autoComplete()" class="form_button" id = "severity_button" value = "low">Low</button>
<button onclick="autoComplete()" class="form_button" id = "severity_button" value = "medium">Medium</button>
<button onclick="autoComplete()" class="form_button" id = "severity_button" value = "high">High</button>
</div>
</div>
<br><br>
<div class="text-info">
<p><em>Enter Information concerning the flaw...</em></p>
</div>
<script>
function autoComplete(){
if(event.target.id == "flaw_type_button"){
document.getElementById('flaw_type').value = event.target.value;
}else if(event.target.id == "severity_button"){
document.getElementById('severity').value = event.target.value;
}
}
</script>
<div class="flaw_submit">
<form action="qualityTests.php" method="post" class= "sameLine" id = "flaw_form">
<input type="hidden" name = "order_id" value = <?php echo $order_id ?>>
<input type="hidden" name = "product_id" value = <?php echo $product_id ?>>
<input type="hidden" name = "product_type" value = <?php echo $product_type ?>>
<input type="hidden" name = "state" value = <?php echo $state ?>>
<input type="text" name="flaw_type" id = "flaw_type" placeholder = "flaw type" class = "flaw_page" value = <?php echo $flaw_type?>>
<br><br>
<input type="severity" name="severity" id = "severity" placeholder = "severity" class = "flaw_page" value = <?php echo $severity?> >
<br><br>
<input onclick = "check()" type="submit" value = "Submit Flaw" class = "flaw_page_submit">
</form>
</div>
<script>
function check(){
var ff = document.getElementById("flaw_form");
var flaw_type = document.getElementById("flaw_type").value;
var severity = document.getElementById("severity").value;
if(flaw_type === "" || severity === ""){
ff.setAttribute('action',"flaw_page.php");
}
else{
ff.setAttribute('action',"qualityTests.php");
}
return true;
}
</script>
</script>
</body>
</html>