-
Notifications
You must be signed in to change notification settings - Fork 0
/
book.php
48 lines (45 loc) · 1.36 KB
/
book.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
include_once "databaseQuery.php";
echo '<html>
<head>
<meta http-equiv ="Content Type" content=text html;charset=utf 8">
<link rel="stylesheet" type="text/css" href="style.css"/>
</head>
<body>
<div id="content">
<h2> Wykaz książek danego Autora </h2>';
if($_SERVER['REQUEST_METHOD']=='GET')
{
echo '<form method="post" action="book.php" class="form-container">
<label for="author">Autor ksiazki:</label><br>
<input type="text" id="author" name="author"><br>
<input type="submit" value="Wyszukaj" class="btn">
</form>';
}
else
{
echo '
<table>
<tr>
<td><b>author</b></td>
<td></b>title</b></td>
</tr>';
$query = new DatabaseQuery();
$books = $query->getBooks();
foreach($books ->book as $book)
{
$author = $book->author;
if (strcasecmp($author,$_POST['author']) == 0)
{
echo '<tr>';
echo "<td>".$author."</td>";
echo "<td>".$book->title."</td>";
echo "</tr>";
}
};
echo '</table> </br></br>';
}
echo '<a href="book.php" class="return">Odśwież</a> ';
echo '<a href="index.html" class="return">Stona główna</a>';
echo '</div> </body> </html>';
?>