-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsearch.php
More file actions
70 lines (68 loc) · 2.33 KB
/
search.php
File metadata and controls
70 lines (68 loc) · 2.33 KB
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
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
</head>
<body>
<div id="top">
<h1 align="center">Search</h1>
</div>
<?php
ini_set("error_reporting", E_ALL);
require_once('UserInterface.php');
if (isset($_POST['ksubmit']) || isset($_POST['isubmit'])){
$ui = new UserInterface();
$books = $ui->postData();
if (empty($books)){
echo "<p align=center>No Results Found</p>";
}else{
foreach($books as $book){
$isbn = $book->getISBN();
$title = $book->getName();
$authors = $book->getAuthor()->getAuthor();
$author = $authors[0];
echo "<p align=center><a href=\"view.php?isbn=$isbn\">\"$title\" by: $author</a></p>";
}
}
if(isset($_POST['ksubmit']))
{
unset($_POST['ksubmit']);
}
if(isset($_POST['isubmit']))
{
unset($_POST['isubmit']);
}
echo "<br><p align='center'><a href='search.php'>New Search</a>";
}
else
{
?>
<form action="search.php" method="POST">
<p align="center">
ISBN:<br><input type="text" name="isbn" autofocus="autofocus" style=width:8em;>
<br><input type="submit" name="isubmit" value="Enter">
</p>
</form>
<br>
<p align="center">Or</p>
<br>
<form action="search.php" method="POST">
<p align="center">
Title:<br><input type="text" name="title" style=width:8em;>
<br>Author:<br><input type="text" name="author" style=width:8em;>
<br>Keywords:<br><input type="text" name="keywords" style=width:8em;>
<br><input type="submit" name="ksubmit" value="Enter">
</p>
</form>
<?php
}
// put your code here
?>
</body>
<br><p align="center"><a href="main.php">Return to Main Page</a>
</html>