-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdashboard_exercise.php
212 lines (196 loc) · 8.67 KB
/
dashboard_exercise.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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
<?php
require('../includes/db_link.inc.php');
require('../includes/functions.inc.php');
$pdo;
$func = new allFunctions();
if(isset($_POST['add_exercise_type_registration'])){
$func->createExerciseType($_POST);
}
if(isset($_POST['equipment_registration'])){
$func->createEquipment($_POST);
}
if(isset($_POST['exercise_registration'])){
$func->createExercise($_POST);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dashboard Exercise</title>
<link rel="stylesheet" href="../style/style.css">
<link rel="stylesheet" href="../style/style_dashboard.css">
</head>
<body>
<header>
<div class="navbar__logo">
<div class="logo">
<a href="#"><img src="crossfit-icon.png" alt=""></a>
<div class="text__logo">
<a href="#"><h1>Crossfit Southport</h1></a>
<a href="#"><p>Lorem ipsum dolor sit amet.</p></a>
</div>
</div>
<div class="links">
<ul>
<li class="item"><a href="dashboard_user.php">User Section</a></li>
<li class="item"><a href="#">Exercise Section</a></li>
<li class="item"><a href="dashboard_workout.php">Workout Section</a></li>
</ul>
</div>
</div>
<div class="navbar__form">
<!-- --------------Login section--------------- -->
<!-- Apply PHP here to use the user's name from database -->
<h2>Welcome user</h2>
</div>
</header>
<main>
<div class="main--wrapper">
<!-- -----------------Add Exercise Type ---------------- -->
<!-- Add PHP to insert informations -->
<div class="form__section">
<h2>Add Exercise Type</h2>
<form method="post">
<div class="input">
<label for="add_exercise_type">Add Exercise Type</label>
<input type="text" name="add_exercise_type">
</div>
<div class="button">
<input type="hidden" name="add_exercise_type_registration">
<button type="submit">Add Exercise Type</button>
</div>
</form>
</div>
<!-- Add PHP to show exercises type details -->
<div class="list__section">
<h2>Exercise Type</h2>
<div class="list__section__wrapper">
<div class="card">
<?php
$list = $func->listExerciseType();
if($list):
foreach($list as $item):
?>
<h3><?= $item['exercise_type']; ?></h3>
<div class="edit__button">
<button type="submit">Edit</button>
</div>
<?php endforeach;?>
<?php endif;?>
</div>
</div>
</div>
<!-- ------------------Add Equipment-------------- -->
<!-- Add PHP to insert informations -->
<div class="form__section">
<h2>Add Equipment</h2>
<form method="post">
<div class="input">
<label for="equipment_name">Add Equipment Name</label>
<input type="text" name="equipment_name">
</div>
<div class="textarea">
<label for="equipment_description">Add Equipment Description</label>
<textarea name="equipment_description"></textarea>
</div>
<div class="button">
<input type="hidden" name="equipment_registration">
<button type="submit">Add Equipment</button>
</div>
</form>
</div>
<!-- --------------List of Equipment------------ -->
<div class="list__section">
<h2>Equipments</h2>
<div class="list__section__wrapper">
<div class="card">
<?php
$list = $func->listEquipment();
if($list):
foreach($list as $item):
?>
<h3><?= $item['equipment_name']; ?></h3>
<p><?= $item['equipment_description']; ?></p>
<?php endforeach;?>
<?php endif;?>
<div class="edit__button">
<button type="submit">Edit</button>
</div>
</div>
</div>
</div>
<!-- ------------------Add Exercise----------------- -->
<div class="form__section">
<h2>Add Exercise</h2>
<form method="post">
<div class="input">
<label for="exercise_name">Exercise Name</label>
<input type="text" name="exercise_name">
</div>
<div class="select">
<label for="exercise_type">Select Exercise Type</label>
<select name="exercise_type">
<?php
$list = $func->listExerciseType();
if($list):
foreach($list as $item):
?>
<!-- How to make this section show all exercise types --> <!-- It's working -->
<option value="<?= $item['id'];?>"><?= $item['exercise_type'];?></option>
<?php endforeach;?>
<?php endif;?>
</select>
</div>
<div class="textarea">
<label for="exercise_description">Exercise Description</label>
<textarea name="exercise_description"></textarea>
</div>
<div class="select">
<label for="equipment_type">Select Equipment Type</label>
<!-- Select equipment from database -->
<select name="equipment_type">
<?php
$list = $func->listEquipment();
if($list):
foreach($list as $item):
?>
<option value="<?= $item['id'];?>"><?= $item['equipment_name'];?></option>
<?php endforeach;?>
<?php endif;?>
</select>
</div>
<div class="button">
<input type="hidden" name="exercise_registration">
<button type="submit">Add Exercise</button>
</div>
</form>
</div>
<!-- --------------List Exercises-------------- -->
<div class="list__section">
<h2>Exercises</h2>
<div class="list__section__wrapper">
<div class="card">
<?php
$list = $func->listExercise();
if($list):
foreach($list as $item):
?>
<!-- How can I use tb_exercise_type_id to have this item name?????? -->
<h3><?= $item['exercise_name']; ?></h3>
<h4><?= $item['exercise_type']; ?></h4>
<h4><?= $item['equipment_name']; ?></h4>
<div class="edit__button">
<button type="submit">Edit</button>
</div>
<?php endforeach;?>
<?php endif; ?>
</div>
</div>
</div>
</div>
</main>
</body>
</html>