-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
93 lines (92 loc) · 2.53 KB
/
index.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
<?php
include 'selector.php';
session_start();
if(!$_SESSION['name']){
header("Location:login.html");
}
$recipes = selectRecipes();
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="style.css">
<title>Recipe</title>
<style>
table {
width:100%;
}
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
th, td {
padding: 15px;
text-align: left;
}
tr:nth-child(even) {
background-color: #eee;
}
tr:nth-child(odd) {
background-color: #fff;
}
th {
background-color: black;
color: white;
}
.button-container{
width: 100%;
margin:0.2rem 2rem;
}
.button-container>button{
align-self: end;
background: #31a9cd;
margin: 5px 3rem;
float: right;
}
</style>
</head>
<body>
<div id="main-container">
<div>
<h1 class="text-center text-red">Welcome to Granny's Recipe Book</h1>
<hr>
<div class="button-container">
<button class="recipe-button" onclick="window.location.assign('add-new.html')">Add New Recipe</button>
</div>
<table >
<tr>
<th>#</th>
<th>Image</th>
<th>Name</th>
<th>Duration</th>
<th>Action</th>
</tr>
<tbody>
<?php
$count = 1;
while($recipe = mysqli_fetch_assoc($recipes)){
?>
<tr>
<td><?=$count++?></td>
<td>
<img src="uploads/<?=$recipe['photo_1']?>" alt="" style="height: 50px">
</td>
<td><?=$recipe['title']?></td>
<td><?=$recipe['time']?></td>
<td>
<a class="recipe-button" href="view-recipe.php?id=<?=$recipe['id']?>">View</a>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
</body>
</html>