-
Notifications
You must be signed in to change notification settings - Fork 0
/
addlab.php
38 lines (36 loc) · 1.08 KB
/
addlab.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
<?php
require_once "common.php";
if (isset($_REQUEST["Title"])) {
#FIXME: duplicate check
list ($lat, $lng) = geocode ($_REQUEST["Postcode"]);
$stmt = $mysqli->prepare ("INSERT INTO labs (InstitutionID, Title, Address, Postcode, Latitude, Longitude) VALUES (?, ?, ?, ?, ?, ?)");
$stmt->bind_param ("isssdd", $_REQUEST["InstitutionID"], $_REQUEST["Title"], $_REQUEST["Address"], $_REQUEST["Postcode"], $lat, $lng);
$stmt->execute();
header ("Location: viewlab.php?ID=".$mysqli->insert_id);
}
common_header ();
?>
<form method="post" action="addlab.php">
<?php
$stmt = $mysqli->prepare ("SELECT ID, Title FROM institutions ORDER BY Title ASC;");
$stmt->execute ();
$stmt->bind_result ($id, $title);
?>
Institution:
<select name="InstitutionID">
<?php
while ($stmt->fetch()) {
?>
<option value="<?php print $id; ?>"><?php print $title; ?></option>
<?php
}
?>
</select><br>
Title: <input type="text" name="Title"><br>
Address: <input type="text" name="Address"><br>
Postcode: <input type="text" name="Postcode"><br>
<input type="submit" value="Add lab">
</form>
<?php
common_footer ();
?>