-
Notifications
You must be signed in to change notification settings - Fork 1
/
customer_search.php
45 lines (41 loc) · 1.65 KB
/
customer_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
<?php include '../view/header.php'; ?>
<main>
<h2>Customer Search</h2>
<!-- display a search form -->
<form action="." method="post">
<input type="hidden" name="action" value="display_customers">
<label>Last Name:</label>
<input type="text" name="last_name"
value="<?php echo htmlspecialchars($last_name); ?>">
<input type="submit" value="Search">
</form>
<?php if (isset($message)) : ?>
<p><?php echo $message; ?></p>
<?php elseif ($customers) : ?>
<h2>Results</h2>
<table>
<tr>
<th>Name</th>
<th>Email Address</th>
<th>City</th>
<th> </th>
</tr>
<?php foreach ($customers as $customer) : ?>
<tr>
<td><?php echo htmlspecialchars(
$customer['firstName'] . ' ' .
$customer['lastName']); ?></td>
<td><?php echo htmlspecialchars($customer['email']); ?></td>
<td><?php echo htmlspecialchars($customer['city']); ?></td>
<td><form action="." method="post">
<input type="hidden" name="action" value="display_customer" />
<input type="hidden" name="customer_id"
value="<?php echo htmlspecialchars($customer['customerID']); ?>" />
<input type="submit" value="Select" />
</form></td>
</tr>
<?php endforeach; ?>
</table>
<?php endif; ?>
</main>
<?php include '../view/footer.php'; ?>