-
Notifications
You must be signed in to change notification settings - Fork 0
/
addExperience.php
242 lines (203 loc) · 13.4 KB
/
addExperience.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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
<?php
$exp_id = '';
if (isset($_GET["id"]) && $_GET["id"] != '') {
$exp_id = $_GET["id"];
}
$GLOBALS["title"] = "Add Experience";
include '_header.php';
include 'actions.php';
if ($exp_id != '') {
$GLOBALS["title"] = "Edit Experience";
$data = "SELECT * FROM experience where id = $exp_id";
// $data = "SELECT experience.* ,courses.name as course_name FROM experience INNER JOIN courses ON experience.course_id = courses.id WHERE experience.id = $exp_id;";
$result = mysqli_query($conn , $data);
$row = mysqli_fetch_assoc($result);
// var_dump($row);
// exit;
//
//$name = $row['name'];
$hours = $row['hours'];
$institution = $row['institution'];
$startDate = $row['start_date'];
$endDate = $row['end_date'];
$notes = $row['notes'];
}
$coursesData = "SELECT * FROM courses";
$resultData = mysqli_query($conn , $coursesData);
?>
<div id="main">
<header class="mb-3">
<a href="#" class="burger-btn d-block d-xl-none">
<i class="bi bi-justify fs-3"></i>
</a>
</header>
<?php if ($exp_id != '') :?>
<div class="page-heading d-flex justify-content-between align-items-center">
<h3 class="d-flex"><?= $GLOBALS["title"] ?></h3>
<a class="d-flex btn btn-secondary" href="experience.php" >Back</a>
</div>
<?php else : ?>
<div class="page-heading">
<h3><?= $GLOBALS["title"] ?></h3>
</div>
<?php endif; ?>
<div class="page-content">
<div class="row ">
<div class="col-12">
<div class="card px-4 py-4">
<div class="card-content">
<div class="card-body">
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="post" enctype="multipart/form-data">
<?php if ($exp_id != '') :?>
<input type="hidden" name="exp_id" value="<?=$exp_id; ?>">
<?php endif;?>
<div class="row">
<!--<div class="col-md-4 col-4">
<php if (isset($experienceErr) && $experienceErr == '') : ?>
<div class="form-group">
<label for="exp_name">experience name</label>
<input type="text" id="exp_name" class="form-control"
name="exp_name"
value="<= $experienceName ?>" placeholder="experience name">
</div>
<php else : ?>
<label for="exp_name">experience name</label>
<input type="text" class="form-control is-invalid" id="exp_name"
name="exp_name"
placeholder="experience name" value="<= $experienceName ?>">
<div class="invalid-feedback">
<i class="bx bx-radio-circle"></i>
<= $experienceErr ?>
</div>
<php endif; ?>
</div>-->
<div class="col-md-4 col-4">
<fieldset class="form-group">
<label for="course_id">Course Name:</label>
<select class="form-select" name="course_id" id="course_id">
<?php
if(mysqli_num_rows($resultData) > 0){
while($row = mysqli_fetch_assoc($resultData)){
?>
<option value="<?=$row['id']?>"><?=$row['name']?></option>
<?php
}
}
?>
</select>
</fieldset>
</div>
<div class="col-md-4 col-4">
<?php if (isset($hoursErr) && $hoursErr == '') : ?>
<div class="form-group">
<label for="hours">Number Of Hours:</label>
<input type="number" class="form-control" id="hours"
placeholder="Number Of Hours" value="<?= $hours ?>"
name="hours">
</div>
<?php else : ?>
<label for="hours">Number Of Hours:</label>
<input type="number" class="form-control is-invalid" id="hours"
placeholder="Number Of Hours" value="<?= $hours ?>" name="hours">
<div class="invalid-feedback">
<i class="bx bx-radio-circle"></i>
<?= $hoursErr ?>
</div>
<?php endif; ?>
</div>
<div class="col-md-4 col-4">
<?php if (isset($institutionErr) && $institutionErr == '') : ?>
<div class="form-group">
<label for="institution">Institution</label>
<input type="text" id="institution" class="form-control"
name="institution"
value="<?= $institution ?>" placeholder="Institution">
</div>
<?php else : ?>
<label for="institution">Institution</label>
<input type="text" class="form-control is-invalid" id="institution"
name="institution"
placeholder="institution" value="<?= $institution ?>">
<div class="invalid-feedback">
<i class="bx bx-radio-circle"></i>
<?= $institutionErr ?>
</div>
<?php endif; ?>
</div>
<div class="col-md-4 col-4">
<?php if (isset($startDateErr) && $startDateErr == '') : ?>
<div class="form-group">
<label for="start-date">Start Date</label>
<input type="date" id="start-date" class="form-control"
placeholder="start date" value="<?= $startDate ?>"
name="start_date">
</div>
<?php else : ?>
<label for="start-date">Start Date</label>
<input type="date" class="form-control is-invalid" id="start-date"
placeholder="start date" value="<?= $startDate ?>"
name="start_date">
<div class="invalid-feedback">
<i class="bx bx-radio-circle"></i>
<?= $startDateErr ?>
</div>
<?php endif; ?>
</div>
<div class="col-md-4 col-4">
<?php if (isset($endDateErr) && $endDateErr == '') : ?>
<div class="form-group">
<label for="end-date">End Date:</label>
<input type="date" id="end-date" class="form-control"
placeholder="End Date" value="<?= $endDate ?>"
name="end_date">
</div>
<?php else : ?>
<label for="end-date">End Date:</label>
<input type="date" class="form-control is-invalid" id="end-date"
placeholder="End Date" value="<?= $endDate ?>"
name="end_date">
<div class="invalid-feedback">
<i class="bx bx-radio-circle"></i>
<?= $endDateErr ?>
</div>
<?php endif; ?>
</div>
<div class="col-md-12 col-12">
<?php if (isset($notesErr) && $notesErr == '') : ?>
<div class="form-group">
<label for="notes">Notes:</label>
<textarea class="form-control" id="notes" rows="3" name="notes"><?= $notes ?></textarea>
<!--<input type="text" id="notes" class="form-control"
placeholder="notes"
value="</*= $notes */?>" name="notes">-->
</div>
<?php else : ?>
<label for="notes">Notes</label>
<!--<input type="text" class="form-control is-invalid" id="notes"
placeholder="notes" name="notes"
value="</*= $notes */?>">-->
<textarea class="form-control is-invalid" id="notes" rows="3" name="notes"><?= $notes ?></textarea>
<div class="invalid-feedback">
<i class="bx bx-radio-circle"></i>
<?= $notesErr ?>
</div>
<?php endif; ?>
</div>
<div class="col-12 d-flex justify-content-end">
<?php if ($exp_id != '') :?>
<input class="btn btn-primary me-1 mb-1" type="submit" value="Edit" name="editExperience">
<?php else : ?>
<input class="btn btn-primary me-1 mb-1" type="submit" value="Submit" name="addExperience">
<?php endif;?>
<button type="reset" class="btn btn-light-secondary me-1 mb-1">Reset</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php include_once '_footer.php'; ?>