-
Notifications
You must be signed in to change notification settings - Fork 8
/
createEventForm.php
121 lines (117 loc) · 6.3 KB
/
createEventForm.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
<?php
require_once 'functions.php';
require_once 'classes/Location.php';
require_once 'classes/LocationTableGateway.php';
require_once 'classes/Connection.php';
$connection = Connection::getInstance();
$gateway = new LocationTableGateway($connection);
$locations = $gateway->getLocations();
if (!isset($formdata)) {
$formdata = array();
}
if (!isset($errors)) {
$errors = array();
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Create Event Form</title>
<?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 Event Form</h1><!--form title-->
<?php
if (isset($errorMessage)) {
echo '<p>Error: ' . $errorMessage . '</p>';
}
?>
<form action="createEvent.php" method="POST" class="form-horizontal">
<div class="form-group">
<label for="Title" class="col-md-2 control-label">Title</label><!--event title-->
<div class="col-md-5">
<input type="text" class="form-control" id="Title" name="Title" value="<?php echoValue($formdata, "Title")?>" /><!--input-->
</div>
<div class="col-md-4">
<span id="TitleError" class="error"><!--error message for invalid input-->
<?php echoValue($errors, 'Title');?>
</span>
</div>
</div>
<div class="form-group">
<label for="Description" class="col-md-2 control-label">Description</label><!--event description-->
<div class="col-md-5">
<input type="text" class="form-control" id="Description" name="Description" value="<?php echoValue($formdata, "Description")?>" /><!--input-->
</div>
<div class="col-md-4">
<span id="DescriptionError" class="error"><!--error message for invalid input-->
<?php echoValue($errors, 'Description');?>
</span>
</div>
</div>
<div class="form-group">
<label for="StartDate" class="col-md-2 control-label">Start Date</label><!--start date-->
<div class="col-md-5">
<input type="text" class="form-control" id="StartDate" name="StartDate" value="<?php echoValue($formdata, "StartDate")?>" /><!--input-->
</div>
<div class="col-md-4">
<span id="StartDateError" class="error"><!--error message for invalid input-->
<?php echoValue($errors, 'StartDate');?>
</span>
</div>
</div>
<div class="form-group">
<label for="EndDate" class="col-md-2 control-label">End Date</label><!--end date-->
<div class="col-md-5">
<input type="text" class="form-control" id="EndDate" name="EndDate" value="<?php echoValue($formdata, "EndDate")?>" /><!--input-->
</div>
<div class="col-md-4">
<span id="EndDateError" class="error"><!--error message for invalid input-->
<?php echoValue($errors, 'EndDate');?>
</span>
</div>
</div>
<div class="form-group">
<label for="Cost" class="col-md-2 control-label">Cost</label><!--cost-->
<div class="col-md-5">
<input type="number" class="form-control" id="Cost" name="Cost" value="<?php echoValue($formdata, "Cost")?>" /><!--input-->
</div>
<div class="col-md-4">
<span id="CostError" class="error"><!--error message for invalid input-->
<?php echoValue($errors, 'Cost');?>
</span>
</div>
</div>
<div class="form-group">
<label for="LocID" class="col-md-2 control-label">Location ID</label><!--location id-->
<div class="col-md-5">
<select name="LocID"
id="LocID"
class="form-control"
>
<?php
foreach ($locations as $location) {
echo '<option value="'.$location['LocationID'].'">'.$location['Name'].'</option>';
}
?>
</select>
</div>
<div class="col-md-4">
<span id="LocIDError" class="error"><!--error message for invalid input-->
<?php echoValue($errors, 'LocID');?>
</span>
</div>
</div>
<button type="submit" class = "btn btn-default pull-right">Create Event <span class="glyphicon glyphicon-send"></span></button>
<a class="btn btn-default navbar-btn" href = "viewEvents.php"><span class="glyphicon glyphicon-circle-arrow-left"></span> Back</a><!--register button-->
</form>
</div>
</div>
<?php require 'utils/footer.php'; ?><!--footer content. file found in utils folder-->
</body>
</html>