-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinsert.php
130 lines (113 loc) · 2.43 KB
/
insert.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
<?php
include_once("include/functions.php");
$dbConnection = get_db_handle();
$status = "";
if (isset(
$_POST["note_content"],
$_POST["short_review"],
$_POST["categories"],
$_POST["research"])) {
if (add_note($_POST['note_content'], $_POST['short_review'], $_POST['research'], $dbConnection)){
$note_id = get_id_from_content($_POST['note_content'], $dbConnection);
foreach ($_POST["categories"] as $a) {
add_section($note_id, $a, $dbConnection);
}
$status = "Note saved";
}
}
?>
<!doctype html>
<html>
<head>
<meta charset='utf-8' />
<title>Dynamic Evolutionary Psychology - Notes Insert Page</title>
<style>
body {
margin: 0px auto;
width 100%;
background-color: #FFF;
color: #212121;
font-family: monospace;
font-size: 20px;
}
.content {
width: 60%;
margin: auto;
}
.title {
text-align: center;
text-decoration: underline;
margin-bottom: 40px;
}
textarea {
background-color: #FFF;
text-align: left;
color: #212121;
border: none;
border: 1px solid #212121;
padding: 10px;
box-shadow: 1px 1px 2px #212121;
}
label {
display: block;
margin-top: 20px;
}
input, textarea, select {
width: 100%;
font-size: 20px;
}
select {
font-size: 20px;
height: 200px;
background-color: #FFF;
color: #212121;
border: none;
border: 1px solid #212121;
}
input {
margin-top: 20px;
background-color: #FFF;
border: 1px solid #212121;
color: #212121;
margin-bottom: 50px;
padding: 10px;
}
.status {
color: green;
}
</style>
</head>
<body>
<div class="content">
<h1 class="title">Dyn.EP Insertion Page</h1>
<div class="status"><?php echo $status ?></div>
<div class="insertion_form">
<form id='time_selection' action='#' method='post'>
<label for="note_content">Note:</label>
<textarea cols='80' rows='10' name="note_content">
</textarea><br/>
<label for="short_review">Short review:</label>
<textarea cols='80' rows='2' name="short_review">
</textarea>
<label>Categories</label>
<select name="categories[]" multiple>
<?php
$all_categories = get_all_categories($dbConnection);
foreach ($all_categories as $id => $cat) {
echo "<option value='";
echo $cat['id'];
echo "'>";
echo $cat['category'];
echo "</option>";
}
?>
</select>
<label for="research">Research Link:</label>
<textarea cols='80' rows='2' name="research">
</textarea>
<input type="submit" value="submit" name="submit" />
</form>
</div>
</div>
</body>
</html>