-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcitizen.php
More file actions
163 lines (145 loc) · 5.14 KB
/
citizen.php
File metadata and controls
163 lines (145 loc) · 5.14 KB
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<?php
require_once('phpScripts/connectScript.php');
require('phpScripts/queueScript.php');
?>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
</head>
<body>
<div class="container">
<!-- Navigation links to the three forms -->
<a href="#" class="btn btn-lg btn-info disabled" aria-disabled="true"><span class="glyphicon glyphicon-user"></span> Citizen</a>
<a href="organisation.php" class="btn btn-lg btn-info"><span class="glyphicon glyphicon-briefcase"></span> Organisation</a>
<a href="anonymous.php" class="btn btn-lg btn-info"><span class="glyphicon glyphicon-question-sign"></span> Anonymous</a>
</div>
<div class="container">
<div class="row">
<div class="col-sm-6">
<h2>Book new customer</h2>
<form class="form-horizontal" name="bookingForm" action="" method="post" >
<fieldset>
<!-- The service that the customer needs: radio buttons -->
<div class="form-group">
<label class="col-md-4 control-label" for="radios">Services</label>
<div class="col-md-4">
<div class="radio">
<label for="radios-0">
<input type="radio" name="service" id="radios-0" value="Housing" checked="checked">
Housing
</label>
</div>
<div class="radio">
<label for="radios-1">
<input type="radio" name="service" id="radios-1" value="Benefits">
Benefits
</label>
</div>
<div class="radio">
<label for="radios-2">
<input type="radio" name="service" id="radios-2" value="Council Tax">
Council Tax
</label>
</div>
<div class="radio">
<label for="radios-3">
<input type="radio" name="service" id="radios-3" value="Fly-tipping">
Fly-tipping
</label>
</div>
<div class="radio">
<label for="radios-4">
<input type="radio" name="service" id="radios-4" value="Missed Bin">
Missed Bin
</label>
</div>
</div>
</div>
<!-- Titles: radio buttons -->
<div class="form-group">
<label class="col-md-4 control-label" for="radios2">Title</label>
<div class="col-md-4">
<label class="radio-inline" for="radios-0">
<input type="radio" name="title" id="radios2-0" value="Miss." checked="checked">
Miss.
</label>
<label class="radio-inline" for="radios-1">
<input type="radio" name="title" id="radios2-1" value="Ms">
Ms.
</label>
<label class="radio-inline" for="radios-2">
<input type="radio" name="title" id="radios2-2" value="Mrs">
Mrs.
</label>
<label class="radio-inline" for="radios-3">
<input type="radio" name="title" id="radios2-3" value="Mr.">
Mr.
</label>
</div>
</div>
<!-- First name textbox -->
<div class="form-group">
<label class="col-md-4 control-label" for="textinput">First Name</label>
<div class="col-md-4">
<input id="textinput" name="firstName" type="text" placeholder="Jon" class="form-control input-md" required="">
</div>
</div>
<!-- Last name textbox -->
<div class="form-group">
<label class="col-md-4 control-label" for="textinput">Last Name</label>
<div class="col-md-4">
<input id="textinput" name="lastName" type="text" placeholder="Snow" class="form-control input-md" required="">
</div>
</div>
<!-- Button will add data to queue table -->
<div class="form-group">
<label class="col-md-4 control-label" for="singlebutton"></label>
<div class="col-md-4">
<button id="singlebutton" name="singlebutton" type="submit" class="btn btn-success">Queue</button>
</div>
</div>
</fieldset>
</form>
<?php
if (isset($_POST["firstName"], $_POST["lastName"], $_POST["service"], $_POST["title"])) {
$successInsert = false;
$conn = makeConnection();
$firstName = $_POST["firstName"];
$lastName = $_POST["lastName"];
$service = $_POST["service"];
$title = $_POST["title"];
$sql = "INSERT INTO Queue (LastName, FirstName, Service, Title, Organisation) VALUES('$lastName', '$firstName', '$service', '$title', 'Not applicable')";
$handle = $conn->prepare($sql);
$successInsert = $handle->execute();
$conn = null;
if ($successInsert) { //Success alert displayed if information is inserted into table successfully
echo '<div class="alert alert-success"><strong>Success!</strong> ' . $firstName . ' has been added to the queue.</div>';
}
else {
echo "Unfortunately, this queuing action has failed, please try again."; //If information cannot be inputted this error message is printed.
}
}
?>
</div>
<div class="col-sm-6">
<h2>Queue</h2>
<table class="table-striped table">
<tr>
<th>Position</th>
<th>First Name</th>
<th>Last Name</th>
<th>Organisation</th>
<th>Service</th>
</tr>
<?php
/* Displays data in queue table
inherited from queueScript.php */
displayQueue();
?>
</table>
</div>
</div>
</div>
</body>
<html>