-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmenu.php
More file actions
99 lines (81 loc) · 1.71 KB
/
Copy pathmenu.php
File metadata and controls
99 lines (81 loc) · 1.71 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<?php
DEFINE('DB_USER', 'root');
DEFINE('DB_PASSWORD', '');
DEFINE('DB_HOST', 'localhost');
DEFINE('DB_NAME', 'cookbook');
$connection = mysqli_connect (DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
if(!$connection){
die("Connection Failed.");
}
$query = "SELECT * FROM recipe ORDER BY recipe_name ASC";
$result = $connection->query($query);
?>
<!DOCTYPE html>
<html>
<head>
<style>
body {
font-family: Arial, sans-serif;
max-width: 800px;
margin: 20px auto;
padding: 0 20px;
}
fieldset {
margin: 15px 0;
padding: 15px;
border: 2px solid #333;
background-color: #f9f9f9;
}
legend {
font-weight: bold;
padding: 0 10px;
font-size: 1.1em;
}
h3 {
margin-top: 0;
margin-bottom: 5px;
}
p {
margin: 0 0 10px 0;
color: #555;
}
.view-btn {
background-color: #337ab7;
color: white;
text-decoration: none;
padding: 8px 15px;
border-radius: 3px;
font-weight: bold;
display: inline-block;
}
.view-btn:hover {
background-color: #286090;
}
.admin-link {
display: block;
margin-top: 20px;
text-align: center;
color: #333;
}
</style>
</head>
<body>
<h1>The Simple Cookbook</h1>
<h4>The simplest cookbook ever!</h4>
<div class="admin-link">
<a href="index.php">Click here to Edit, Delete, or Add your own recipes and ingredients!</a>
</div>
<?php
if($result){
while($row = mysqli_fetch_array($result))
{
echo "<fieldset>";
echo "<legend>" . $row['recipe_name'] . "</legend>";
echo "<p>" . $row['description'] . "</p>";
echo "<a href='details.php?id=" . $row['recipe_id'] . "' class='view-btn'>View Recipe</a>";
echo "</fieldset>";
}
}
?>
</body>
</html>