-
Notifications
You must be signed in to change notification settings - Fork 0
/
form_Laboratory.php
136 lines (118 loc) · 4.75 KB
/
form_Laboratory.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<?php
include 'connect.php';
$link = connect();
if(!$resultleader = mysqli_query($link,"SELECT * FROM `Account`")){
echo "Failed to query database for UserID options";
}
if(!$resultlocation = mysqli_query($link, "SELECT * FROM `SamplingLocation`")){
echo "Failed to query database for LocationID options";
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Åquamän</title>
<link rel="stylesheet" type="text/css" href="css/main.css?ts=<?=time()?>">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js?ts=<?=time()?>"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js?ts=<?=time()?>"></script>
<!-- Favicon-->
<link rel="icon" type="image/x-icon" href="assets/favicon.ico" />
<!-- Font Awesome icons (free version)-->
<script src="https://use.fontawesome.com/releases/v5.15.4/js/all.js?ts=<?=time()?>" crossorigin="anonymous"></script>
<!-- Google fonts-->
<!-- Core theme CSS (includes Bootstrap)-->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Trirong">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Rancho&effect=fire-animation">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<link href='https://fonts.googleapis.com/css?family=Vampiro One' rel='stylesheet'>
<script src="scroll-down.js"></script>
<style>
h1 {
font-family: Trirong;
h2 {
font-family: Trirong;
}
h3 {
font-family: Trirong;
}
h3 {
font-family: "Trirong", serif;
}
</style>
</head>
<body style="font-family: Trirong";>
<?php include "standardAssets.php"; pageheader();?>
<!--Content-->
<div class="body">
<h2>Add Laboratory</h2>
<form action="add_laboratory.php" method="POST">
<label for="LabName">Laboratory Name:</label>
<input type="text" name="LabName" maxlength="30" require><br>
<label for="Country">Country:</label>
<input type="text" name="Country" maxlength="40"><br>
<label for="City">City:</label>
<input type="text" name="City" maxlength="40"><br>
<label for="LabAddress">Laboratory Address:</label>
<input type="text" name="LabAddress" maxlength="100"><br>
<?php
echo "<input type='hidden' name='MainAccount' value='".$_SESSION['UserID']."'>"
?>
<!--<label for='MainAccount'>Main Account:</label>
<select name='MainAccount' id='MainAccount' require>
<?php
// Echo leader options for the drop down list
/*
while($row = mysqli_fetch_assoc($resultleader)) {
$catid = $row["UserID"];
$catname = $row["Firstname"].' '.$row["Lastname"];
echo "<option value='$catid'>$catname</option>";
}*/
?>
</select><br>-->
<input type="submit" value="Submit">
</form>
<?php
include 'check_injection.php';
//Connect to DB for search
$link = connect();
$sql = "SELECT * FROM Laboratory";
if(isset($_POST["search"])){
$clean = check_injection($link, $_POST);
$search= $clean["search"];
$result = mysqli_query($link, $sql ."WHERE Labname LIKE '$search'");
if (mysqli_num_rows($result) == 0) {
sconnect($link);
header('Location: form_location.php?error=noresults');
exit;
}
}else {
$result = mysqli_query($link,$sql);
}
echo "<table border='1'>";
echo "<tr>
<th>ID</th>
<th>Lab Name</th>
<th>Country</th>
<th>City</th>
<th>LabAdress</th>
</tr>";
while($row = mysqli_fetch_row($result)){
echo "<tr>
<td>".$row[0]."</td>"
."<td>".$row[1]."</td>"
."<td>".$row[2]."</td>"
."<td>".$row[3]."</td>"
."<td>".$row[4]."</td>"
."</tr>";
}
echo "</table>";
dconnect($link);
?>
</div> <!--/page-->
<?php pagefooter();?>
</body>
</html>