-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrecipe.php
163 lines (158 loc) · 5.42 KB
/
recipe.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<?php
include 'database.php';
//make sure connection is good
$query = "SELECT * FROM Food";
$result = mysqli_query($connection, $query);
if (!$result) {
die ("Database query failed.");
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Cookbook</title>
<link rel="stylesheet" type="text/css" title="Stylesheet" href="css/styles.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
<!-- Header -->
<header class="header">
<p>Ms.Grey's Cookbook</p>
<!-- menu icon -->
<span class="menuIcon" onclick="openMenu()">☰</span>
</header>
<!-- menu -->
<div id= "sideMenu" class="sideMenu">
<ul>
<li><a href="javascript:void(0)" class="close" onclick="closeMenu()">×</a></li>
<li><a href="index.php">Home</a></li>
<li><a href="help.php">Help</a></li>
<li><a href="allrecipes.php">All Recipes</a></li>
<li><div class="searchContainer">
<form action="search.php">
<input type="text" placeholder="Search..." name="search">
<button type="submit"><i class="fa fa-search"></i></button>
</form>
</div></li>
</ul>
</div>
<!-- Content -->
<section class="info">
<?php
//get ID from URL
$id = $_GET['id'];
//get recipe from ID
$query = "SELECT * FROM Food WHERE ID = $id";
$result = mysqli_query($connection, $query);
//html stuff here
while ($row = mysqli_fetch_assoc($result)){ ?>
<h1><?php echo $row['Main_Heading']?></h1>
<h3><?php echo $row['Sub_Heading']?></h3>
<div class="content">
<div class="item">
<picture>
<source srcset="<?php echo $row['Main_Pic'];?>" media="(min-width: 768px)" />
<img src="<?php echo $row['Main_Pic'];?>" style="width: 100%;" />
</picture>
</div>
<div class="item">
<p><?php echo $row['Description']; ?></p>
</div>
</div>
<h3>Ingredients</h3>
<div class="content">
<div class="itemIng">
<picture>
<source srcset="<?php echo $row['Ingredients_Pic'];?>" media="(min-width: 768px)" />
<img src="<?php echo $row['Ingredients_Pic'];?>" />
</picture>
</div>
<div class="itemIng">
<ul>
<?php echo $row['Ingredients'];?>
</ul>
</div>
</div>
<h3>Directions</h3>
<div class="content">
<div class="item">
<picture>
<source srcset="<?php echo $row['Step_One_Pic'];?>" media="(min-width: 768px)" />
<img src="<?php echo $row['Step_One_Pic'];?>" />
</picture>
</div>
<div class="item">
<p><?php echo $row['Step_One'];?></p>
</div>
</div>
<div class="content">
<div class="item">
<picture>
<source srcset="<?php echo $row['Step_Two_Pic'];?>" media="(min-width: 768px)" />
<img src="<?php echo $row['Step_Two_Pic'];?>" />
</picture>
</div>
<div class="item">
<p><?php echo $row['Step_Two'];?></p>
</div>
</div>
<div class="content">
<div class="item">
<picture>
<source srcset="<?php echo $row['Step_Three_Pic'];?>" media="(min-width: 768px)" />
<img src="<?php echo $row['Step_Three_Pic'];?>" />
</picture>
</div>
<div class="item">
<p><?php echo $row['Step_Three'];?></p>
</div>
</div>
<div class="content">
<div class="item">
<picture>
<source srcset="<?php echo $row['Step_Four_Pic'];?>" media="(min-width: 768px)" />
<img src="<?php echo $row['Step_Four_Pic'];?>" />
</picture>
</div>
<div class="item">
<p><?php echo $row['Step_Four'];?></p>
</div>
</div>
<div class="content">
<div class="item">
<picture>
<source srcset="<?php echo $row['Step_Five_Pic'];?>" media="(min-width: 768px)" />
<img src="<?php echo $row['Step_Five_Pic'];?>" />
</picture>
</div>
<div class="item">
<p><?php echo $row['Step_Five'];?></p>
</div>
</div>
<div class="content">
<div class="item">
<picture>
<source srcset="<?php echo $row['Step_Six_Pic'];?>" media="(min-width: 768px)" />
<img src="<?php echo $row['Step_Six_Pic'];?>" />
</picture>
</div>
<div class="item">
<p><?php echo $row['Step_Six'];?></p>
</div>
</div>
<?php }
?>
<!--</section>-->
<!-------------->
<?php
mysqli_free_result($result);
?>
<?php
mysqli_close($connection);
?>
<!-- Blank -->
<script src="js/main.js"></script>
</body>
</html>