-
Notifications
You must be signed in to change notification settings - Fork 8
/
createLocationForm.php
171 lines (167 loc) · 9.91 KB
/
createLocationForm.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
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
164
165
166
167
168
169
170
171
<?php
require_once 'functions.php';
if (!isset($formdata)) {
$formdata = array();
}
if (!isset($errors)) {
$errors = array();
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Create Location Form</title>
<style>
span.error{
color: red;
}
</style>
<?php require 'utils/styles.php'; ?><!--css links. file found in utils folder-->
<?php require 'utils/scripts.php'; ?><!--js links. file found in utils folder-->
</head>
<body>
<?php require 'utils/header.php'; ?><!--header content. file found in utils folder-->
<div class="content">
<div class="container">
<h1>Create Location Form</h1><!--form title-->
<?php
if (isset($errorMessage)) {
echo '<p>Error: ' . $errorMessage . '</p>';
}
?>
<form action="createLocation.php" method="POST" class="form-horizontal">
<div class="form-group">
<label for="Name" class="col-md-2 control-label">Location Name</label>
<div class="col-md-5">
<input type="text" class="form-control" id="Name" name="Name" value="<?php echoValue($formdata, "Name")?>" /><!--input-->
</div>
<div class="col-md-4">
<span id="LNameError" class="error"><!--error message for invalid input-->
<?php echoValue($errors, 'Name');?>
</span>
</div>
</div>
<div class="form-group">
<label for="Address" class="col-md-2 control-label">Address</label>
<div class="col-md-5">
<input type="text" class="form-control" id="Address" name="Address" value="<?php echoValue($formdata, "Address")?>" /><!--input-->
</div>
<div class="col-md-4">
<span id="LAddressError" class="error"><!--error message for invalid input-->
<?php echoValue($errors, 'Address');?>
</span>
</div>
</div>
<div class="form-group">
<label for="managerFName" class="col-md-2 control-label">Manager First Name</label>
<div class="col-md-5">
<input type="text" class="form-control" id="managerFName" name="managerFName" value="<?php echoValue($formdata, "managerFName")?>" /><!--input-->
</div>
<div class="col-md-4">
<span id="mNameError" class="error"><!--error message for invalid input-->
<?php echoValue($errors, 'managerFName');?>
</span>
</div>
</div>
<div class="form-group">
<label for="managerLName" class="col-md-2 control-label">Manager Last Name</label>
<div class="col-md-5">
<input type="text" class="form-control" id="managerName" name="managerLName" value="<?php echoValue($formdata, "managerLName")?>" /><!--input-->
</div>
<div class="col-md-4">
<span id="mNameError" class="error"><!--error message for invalid input-->
<?php echoValue($errors, 'managerLName');?>
</span>
</div>
</div>
<div class="form-group">
<label for="managerEmail" class="col-md-2 control-label">Manager Email</label>
<div class="col-md-5">
<input type="email" class="form-control" id="managerEmail" name="managerEmail" value="<?php echoValue($formdata, "managerEmail")?>" /><!--input-->
</div>
<div class="col-md-4">
<span id="mEmailError" class="error"><!--error message for invalid input-->
<?php echoValue($errors, 'managerEmail');?>
</span>
</div>
</div>
<div class="form-group">
<label for="managerNumber" class="col-md-2 control-label">Manager Number</label>
<div class="col-md-5">
<input type="number" class="form-control" id="managerNumber" name="managerNumber" value="<?php echoValue($formdata, "managerNumber")?>" /><!--input-->
</div>
<div class="col-md-4">
<span id="mNumError" class="error"><!--error message for invalid input-->
<?php echoValue($errors, 'managerNumber');?>
</span>
</div>
</div>
<div class="form-group">
<label for="locationMaxCap" class="col-md-2 control-label">Max Capacity</label>
<div class="col-md-5">
<input type="number" class="form-control" id="locationMaxCap" name="maxCap" value="<?php echoValue($formdata, "maxCap")?>" /><!--input-->
</div>
<div class="col-md-4">
<span id="capError" class="error"><!--error message for invalid input-->
<?php echoValue($errors, 'maxCap');?>
</span>
</div>
</div>
<!--codes below has no connection with the database.-->
<div class="form-group">
<label class="col-md-2 control-label">Location Type</label><!--radio buttons with multiple options-->
<div class="col-md-5">
<input type="radio" name="lType" value="indoor" <?php echoChecked($formdata, "lType", "indoor"); ?> >Indoor <br>
<input type="radio" name="lType" value="outdoor" <?php echoChecked($formdata, "lType", "outdoor"); ?>>Outdoor <br>
<input type="radio" name="lType" value="both" <?php echoChecked($formdata, "lType", "both"); ?>>Both
</div>
<div class="col-md-4">
<span id="typeError" class="error">
</span>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">Seating Available</label>
<div class="col-md-5">
<select class="form-control" name="seat">
<option value="yes" <?php echoSelected($formdata, "seat", "yes"); ?>>Yes</option>
<option value="no" <?php echoSelected($formdata, "seat", "no"); ?>>No</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">Facilities</label>
<div class="col-md-5">
<input type="checkbox" name="facilities[]" value="sound" <?php echoCheckedArray($formdata, 'facilities', 'sound'); ?> >Sound Room <br>
<input type="checkbox" name="facilities[]" value="screen" <?php echoCheckedArray($formdata, "facilities", "screen"); ?> >Big Screen Room <br>
<input type="checkbox" name="facilities[]" value="restaurant" <?php echoCheckedArray($formdata, "facilities", "restaurant"); ?> >Restaurants <br>
<input type="checkbox" name="facilities[]" value="bar" <?php echoCheckedArray($formdata, "facilities", "bar"); ?> >Bar <br>
<input type="checkbox" name="facilities[]" value="disabled" <?php echoCheckedArray($formdata, "facilities", "disabled"); ?> >Disabled Access Toilets <br>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">Url</label>
<div class="col-md-5">
<input type="text" class="control-label" name="link">
</div>
<div class="col-md-4">
<span id="urlError" class="error">
<?php echoValue($errors, 'link');?>
</span>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">Attach File:</label>
<div class="col-md-5">
<input type="file" class="control-label" name="attachment">
</div>
</div>
<button type="submit" name="createLocation" class="btn btn-default pull-right">Create Location <span class="glyphicon glyphicon-send"></span></button>
</form>
<a class="btn btn-default" href="viewLocations.php"><span class="glyphicon glyphicon-circle-arrow-left"></span> Back</a><!--return/back button-->
</div>
</div>
<?php require 'utils/footer.php'; ?><!--footer content. file found in utils folder-->
</body>
</html>