/
search.php
138 lines (124 loc) · 4.8 KB
/
search.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
<html>
<head>
<title>Event search</title>
<?php require("style/linkcss.php"); ?>
</head>
<body>
<?php require("style/header.php");
require("database.php");
?>
<div id="index-banner" class="parallax-container">
<div class="section no-pad-bot">
<div class="container">
<br><br>
<h1 class="header center blue-text">Search events!</h1>
<br><br>
<div class="row center">
<h5 class="header col s12 light">Complete the search terms or leave them empty if you want to see all the events</h5>
</div>
<div class="row center">
<h5 class="header col s12 light">Change your postcode if you want to see events near you</h5>
</div>
<br>
</div>
</div>
</div>
<div class="container">
<div class="section">
<div class="row">
<div class="col s12"><br>
<div id="searchForm" class="eventForm">
<form id="search" action="search.php#content" method="get">
<div class="row">
<div class="input-field col s6">
<label for="evtitle">Name of Event</label>
<input type="text" name="evtitle" value='<?php echo $_GET['evtitle'] ?>' />
</div>
<div class="input-field col s6">
<label for="evdesc">Additional Search Terms</label>
<input type="text" name="evdesc" value='<?php echo $_GET['evdesc'] ?>' />
</div>
</div>
<div class="input-field">
<label for="evdate">Date</label>
<input type="text" class="datepicker" name="evdate" value='<?php echo $_GET['evdate'] ?>' />
</div>
<div class="input-field">
<label for="evpostcode">Event Postcode</label>
<input type="text" name="evpostcode" value='<?php echo $_GET['evpostcode'] ?>'/>
</div>
<div class="input-field">
<label for="maxdist">Maximum Distance (mi)</label>
<input type="text" name="maxdist" value='<?php echo $_GET['maxdist'] ?>'/>
</div>
<div class="input-field">
<label>City</label><br>
<select name = "city" >
<option value="">Any</option>
<option value="<?php echo Cities::MANCHESTER;
if ($_GET['city'] == Cities::MANCHESTER) echo '" selected "'?>">Manchester</option>
<option value="<?php echo Cities::LIVERPOOL;
if ($_GET['city'] == Cities::LIVERPOOL) echo '" selected "'?>">Liverpool</option>
<option value="<?php echo Cities::SHEFFIELD;
if ($_GET['city'] == Cities::SHEFFIELD) echo '" selected "'?>">Sheffield</option>
</select>
</div>
<button type="submit" class="btn waves-effect waves-light">
Search
<i class="mdi-content-send right"></i>
</button>
</form>
</div> <!-- End of form div -->
</div> <!-- End of search terms columns -->
</div>
</div>
</div>
<?php for($i=0;$i<=20;$i++) echo "<br>"; ?>
<div id="content" class="container">
<button class="btn waves-effect waves-light"
onclick="$('#index-banner').goTo();">
Search for something else
</button>
<div class="row">
<div class="col s12">
<?php
//Retrieve vars
$name = $_GET['evtitle'];
$date = $_GET['evdate'];
$post = $_GET['evpostcode'];
//For the database
$description=$_GET['evdesc'];
$maxdist = $_GET['maxdist'];
$id = $_GET['city'];
$location="";
$results = search_events($name, $location, $date, $description, $post,$maxdist, $id);
displayResults($results);
?>
</div>
</div> <!-- End of results -->
</div>
<script>
$(function() {
$( ".datepicker" ).pickadate();
});
$(document).ready(function() {
$('select').material_select();
$("table")
.tablesorter({widthFixed: true, widgets: ['zebra']})
.tablesorterPager({container: $(".pager")});
});
</script>
<?php require("style/footer.php"); ?>
</body>
<script>
(function($) {
$.fn.goTo = function() {
$('html, body').animate({
scrollTop: $(this).offset().top + 'px'
}, 'fast');
return this; // for chaining...
}
})(jQuery);
$(document).ready(function(){$(window.location.hash).goTo();});
</script>
</html>