-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch_page.php
75 lines (45 loc) · 1.71 KB
/
search_page.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
<!--Code reuse in progress: career pathways here-->
<?php include('library/head_section.inc');?>
<?php include('library/nav_section.inc');?>
<body>
<div class="container" id="main">
<div class="page-text">
<h1>Search Results</h1>
<p>Here are the search results we found for your search query:</p>
</div>
<section class="row1">
<?php require('library/connect.php');
//checks to see that the array was delivered
//print_r($_POST);
$search_item = $_POST['search_item'];
$query = "SELECT * FROM careercards
WHERE careertype LIKE '%$search_item%'
OR description LIKE '%$search_item%' ";
$result = mysqli_query($connect, $query);
if(!$result) {
echo 'No Search results.';
}
elseif (mysqli_num_rows($result) == 0 ) {
echo 'No Results in Search.';
} else {
echo '<div class="card-deck" id="career_pathways">';
while ($row = mysqli_fetch_array($result)) {
$link = str_replace(' ', '_', strtolower($row['careertype']));
echo '<div class="card" style="width: 20rem;">';
// echo '<img class="card-img-top" src="'.$row['images'].'" alt="Career Type" height="200" width="300">';
echo '<img class="card-img-top" src="images/'.$link.'.jpg" alt="'.$row['careertype'].'" height="200" width="300">';
echo '<div class="card-body">';
echo'<h4 class="card-title">'.$row['careertype'].'</h4>';
echo '<p class="card-text">Location: '.$row['description'].'</p>';
echo '<a href="'.$row['phpurl'].'" class="btn btn-primary mt-auto">Learn more</a>';
echo '</div>';
echo '</div>';
}
echo '</div>';
}
?>
</section><!-- This is the end of the Device search results from the kirkwood_bas database. -->
<br>
</div><!--Close Container-->
</body>
<?php include('library/footer_section_two.inc');?>