-
Notifications
You must be signed in to change notification settings - Fork 0
/
langData.php
53 lines (44 loc) · 1.79 KB
/
langData.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Language Data Submission</title>
</head>
<body>
<div id = "content">
<?php
require_once("db.php"); // connect to database
// retrieve data from html form
$language = $_POST['language'];
$certainty = $_POST['certainty'];
// $area = $_POST['area'];
$comments = $_POST['comments'];
$datetime = date("M d, Y h:i A");
$geojson = $_POST['geojson'];
//validate form and show data back to user
if (!empty($language) && is_string($language)) {
echo "<hr>";
echo "<h4>Your information has been submitted! </h4>";
echo "<p><strong>Language: </strong>{$language}</p>";
echo "<p><strong>Degree of certainty: </strong>{$certainty}</p>";
echo "<p><strong>Area of selected polygon: </strong></p>";
echo "<p><strong>Date and time submitted: </strong>{$datetime}</p>";
echo "<p><strong>Comments: </strong>{$comments} </p>";
echo "<hr>";
} else {
echo "Please enter valid characters in the language field. ";
}
$insertQuery = "INSERT INTO languagedata(language, certainty, comments, submit_datetime, polygon_json) VALUES('$language','$certainty','$comments', '$datetime', '$geojson')";
$executeQuery = pg_query($insertQuery);
// Error message if data cannot be inserted into table
if (!$executeQuery) {
echo "<p>Error: failed to insert data! Please try again. </p>";
}
// Closing connection
pg_close($db_conn);
?>
</div>
</body>
</html>