-
Notifications
You must be signed in to change notification settings - Fork 0
/
search.php
81 lines (75 loc) · 2.58 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
<?php
session_start();
//erase any previous search results
//---------------------------------------
//author: Lindsey Wells
/*description: used to search for specific people in one or all yearbooks that
* have been previously imported.
*/
//---------------------------------------
unset($_SESSION['SearchResults']);
unset($_SESSION['row_count']);
unset($_SESSION['SearchDetails']);
$connString = "mysql:host=localhost;dbname=GusNicholsLibrary";
$user ="root";
$pass ="root";
try {
$pdo = new PDO($connString, $user, $pass);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
//echo 'Connected successfully<hr>';
}
catch(PDOException $e)
{
echo 'Connection failed: ' . $e->getMessage();
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset=UTF-8>
<link rel="stylesheet" href="css/Style.css">
<title>Gus Nichols Archives</title>
</head>
<body>
<div class="nav">
<!--Banner and navigation bar !-->
<img src="images/GusNicholsBanner.jpg" alt="Gus Nichols Archives Banner" height="79" width="1360">
<ul>
<li><a href="index.php">Home</a></li>
<li><a href="ChoosePublicationToView.php">View Publications</a></li>
<li><a href="importFile.php">Import Yearbook</a></li>
</ul>
</div>
<hr>
<!--Banner and navigation bar !-->
<div class="wrap">
<h1>Person Search</h1>
<form method='post' action='SearchResults.php'>
<h3>First Name</h3>
<input type='text' name='fname' />
<br><br>
<h3>Last Name</h3>
<input type='text' name='lname' required />
<br><br>
<p>If searching for a building, company, or group (ex. a social club)
use the last name textbox only</p>
<h3>Yearbook</h3>
<select name="PubName">
<?php
$sql = "SELECT Name FROM Publication";
$result= $pdo->query($sql);
echo "<option selected>All</option>";
while($val= $result->fetch()):
$publicationName= $val['Name'];
{
echo "<option>".$publicationName."</option>";
}
endwhile;
?>
</select>
<br><br>
<input type='submit' value='Search'>
</form>
</div>
</body>
</html>