-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
59 lines (54 loc) · 1.85 KB
/
index.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta charset="UTF-8">
<link rel="icon" href="img/page-icon.png">
<title>Riney</title>
<!-- bootstrap css -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
</head>
<body class="container">
<h1>Totally Lookup A Movie</h1>
<form method="GET" action="" class="form">
<input type="search"
name="title"
class="form-control"
value= "<?= htmlspecialchars($_GET['title'], ENT_QUOTES, 'Utf-8') ?>"
placeholder="search by title">
</form>
<table>
<thead>
<tr>
<th>Title</th>
<th class="text-right">Release Date</th>
<th class="text-right">Tickets Sold</th>
<th class="text-right">Gross Revenue</th>
</tr>
</thead>
<tbody>
<?php
require_once 'connection.php';
require_once 'models/movie-model.php';
$con = getConnection();
$moviemodel = new Search($con);
//$q = $_GET['q'];
//$matches = $moviemodel->getDetail($q);
$q = $_GET['title'];
$matches = $moviemodel->search($q);
//print_r($matches);
foreach($matches as $row):
?>
<tr>
<td><a href="views/detail.php?q=<?= $row['ID']?>"><?= $row['title']?></td>
<td><?= $row['released']?></td>
<td><?= $row['tickets']?></td>
<td>$<?= $row['gross']?></td>
</tr>
<?php
endforeach;
?>
</tbody>
</table>
</body>
</html>