-
Notifications
You must be signed in to change notification settings - Fork 0
/
departed.php
200 lines (157 loc) · 6.24 KB
/
departed.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
<?php
session_set_cookie_params(0);
session_start();
include('includes/config.php');
include('database.php');
if (strlen($_SESSION['login']) == 0) {
header('location: login.php');
} else {
if (isset($_POST['submit'])) {
$name = $_POST['name'];
$gender = $_POST['gender'];
$dob = $_POST['dob'];
$dod = $_POST['dod'];
$position = $_POST['position'];
$profession = $_POST['profession'];
$cause = $_POST['cause'];
$email3 = $_SESSION['login'];
$sql3 = "SELECT `id` FROM `users` WHERE `email`=:email3";
$query3 = $dbh->prepare($sql3);
$query3->bindParam(':email3', $email3, PDO::PARAM_STR);
$query3->execute();
$results3 = $query3->fetchAll(PDO::FETCH_OBJ);
if ($query3->rowCount() > 0) {
foreach ($results3 as $result3) {
$userid = $result3->id;
}
}
foreach ($_POST['name'] as $key => $value) {
$query3 = "INSERT INTO deceased(name,gender,dob,dod,position,profession,cause,userid)VALUES ('" . $_POST['name'][$key] . "','" . $_POST['gender'][$key] . "','" . $_POST['dob'][$key] . "','" . $_POST['dod'][$key] . "','" . $_POST['position'][$key] . "','" . $_POST['profession'][$key] . "','" . $_POST['cause'][$key] . "','$userid')";
mysqli_query($conn, $query3);
header('location:animals.php');
}
}
?>
<!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>Departed Details Page</title>
<!-- font awesome -->
<script src="//cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/all.min.css"></script>
<script src="https://kit.fontawesome.com/d663acac4f.js" crossorigin="anonymous"></script>
<!-- font awesome -->
<!-- google fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,400;1,900&display=swap" rel="stylesheet">
<!-- google fonts -->
<!-- css-->
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/bootstrap5.min.css">
<!--
<link rel="stylesheet" href="https://cdn.datatables.net/1.12.1/css/dataTables.bootstrap5.min.css" /> -->
</head>
<body>
<!-- Navbar -->
<?php include('includes/head.php') ?>
<!-- Navbar -->
<div class="container-fluid">
<div class="container-sm">
<div class="text-start">
<p class="text-danger text-small">
Public private life is protected by the constitution of kenya.
Kindly be honest while filling this questionnaire.
Incase of assistance call 0741036409. Please follow all steps and fill in information from section A to E.
</p>
<p class="text-small">
C. Details of deceased members.
</p>
</div>
</div>
<div class="row bg-light justify-content-center">
<div class="col-lg-12 col-sm-12">
<form action="" method="post" enctype="">
<fieldset>
<br>
<h5 class="ml-2">Fill details of the deceased members:</h5>
<div >
<div class="table-responsive">
<table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
<tr >
<th>Full Name</th>
<th>Gender</th>
<th>DOB</th>
<th>Death Date</th>
<th>Position</th>
<th>Profession</th>
<th>Cause of death</th>
<th>More Fields</th>
</tr>
</thead>
<tbody id="dynamic_field3">
<tr>
<td> <input required="true" type="text" class="col-sm-12" name="name[]" placeholder="Name"></td>
<td>
<select name="gender" required="true" class="col-sm-12">
<option value="">--Select--</option>
<option value="Male">Male</option>
<option value="Female">Female</option>
<option value="Others">Others</option>
</select>
</td>
<td><input type="date" required="true" class="form-control" name="dob[]"></td>
<td><input
required="true" class="form-control"
type="datetime-local" min="2019-01-01T00:00" max="2029-12-31T00:00"
name="dod[]"></td>
<td><input type="text" required="true" class="col-sm-12" name="position[]" placeholder="Position"></td>
<td><input type="text" required="true" class="col-sm-12" name="profession[]" placeholder="Profession"></td>
<td><input type="text" required="true" class="col-sm-12" name="cause[]" placeholder="Cause of death"></td>
<td><button type="button" name="add" id="add3" class="btn btn-success"><i class="fa fa-plus"></i></button></td>
</tr>
</tbody>
</table>
</div>
</div>
<br>
<div class="form-row "><br>
<div class="col float-start mx-4">
<a href="house.php" class="btn btn-primary mb-4 " value="Save">Back</a>
</div>
<div class="col float-end mx-4">
<button type="submit" id='submit' name="submit" class="btn btn-primary">Save the form data</button>
</div>
</div>
<br>
</fieldset>
</form>
</div>
</div>
</div>
</div>
<?php include('includes/footer.php')?>
<a href="#" class="btn btn-lg btn-primary btn-lg-square rounded-circle back-top float-end"><i class="fa fa-arrow-up"></i></a>
<!--- scripts -->
<script src="js/jquery-3.6.1.min.js"></script>
<script>
$(document).ready(function () {
var i = 1;
$('#add3').click(function () {
i++;
$('#dynamic_field3').append('<tr id="row3' + i + '"><td> <input type="text" required="true" class="form-control" name="name[]" placeholder="Name"></td><td><select required="true" name="gender" class="form-select"><option value="">--Select--</option><option value="Male">Male</option><option value="Female">Female</option><option value="Others">Others</option></select></td> <td><input required="true" type="date" class="form-control" name="dob[]"> </td> <td><input required="true" class="form-control" type="datetime-local" min="2019-01-01T00:00" max="2029-12-31T00:00" name="dod[]"></td> <td><input type="text" required="true" class="form-control" name="position[]" placeholder="Position"></td><td><input type="text" required="true" class="form-control" name="profession[]" placeholder="Profession"></td> <td><input type="text" required="true" class="form-control" name="cause[]" placeholder="Cause of death"></td><td><button type="button" name="add" class="btn btn-danger btn_remove3" id="' + i + '"><i class="fa fa fa-trash"></i></button></td></tr>');
});
$(document).on('click', '.btn_remove3', function () {
var button_id = $(this).attr("id");
$('#row3' + button_id + '').remove();
});
});
</script>
<script src="js/bootstrap.bundle.min.js"></script>
</body>
</html>
<?php
}
?>