-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsearch.php
48 lines (37 loc) · 1.11 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
<?php require('core/init.php');
$pdo = DB::getInstance()->getPDO();
if (isset($_POST['btn_search'])){
$search = $_POST['movie'];
$results = searchByTitle($search);
}
if (isset($_POST['btn_asearch'])){
$year = @$_POST['year'];
$genre = @$_POST['genre'];
$language = @$_POST['language'];
$country = @$_POST['country'];
$aresults = advancedSearch($year, $genre, $country, $language);
}
?>
<?php require('templates/header.php'); ?>
<div class="row">
<div class="col-md-8 col-md-offset-2">
<h1>Results:</h1>
<div class="list-group">
<?php
if (!empty($results)){
foreach ($results as $result) {
if(isset($result['title']))
echo "<a href='details.php?imdbID=".$result['imdbID']."' class='list-group-item'>".$result['title']."</a>";
}
}else if (!empty($aresults)) {
foreach ($aresults as $result) {
if(isset($result['title']))
echo "<a href='details.php?imdbID=".$result['imdbID']."' class='list-group-item'>".$result['title']."</a>";
}
}
else echo "No Result!";
?>
</div>
</div>
</div>
<?php require('templates/footer.php'); ?>