-
Notifications
You must be signed in to change notification settings - Fork 0
/
certificateGenerator.php
214 lines (178 loc) · 6.44 KB
/
certificateGenerator.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Fetch Data by ID</title>
<style>
body {
font-family: 'Arial', sans-serif;
background-color: #f8f9fa;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.container {
background-color: #ffffff;
border: 1px solid #ced4da;
border-radius: 5px;
padding: 0 25px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
display:flex;
flex-direction:column;
align-items:center;
}
h2 {
color: #007bff;
margin-bottom: 20px;
}
form {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items:center;
margin:25px;
}
.form-group {
flex-basis: calc(33.33% - 10px);
margin-bottom: 15px;
}
label {
font-weight: bold;
display: block;
margin-bottom: 5px;
}
input {
width: 100%;
padding: 10px;
box-sizing: border-box;
border: none;
border-radius: 4px;
background-color: #f8f9fa;
}
input[type="text"] {
font-size: 16px;
color: #495057;
cursor: not-allowed;
}
input[type="submit"] {
background-color: #007bff;
color: #fff;
cursor: pointer;
transition: background-color 0.3s ease;
width:50%;
margin:0 25%;
}
input[type="submit"]:hover {
background-color: #0056b3;
}
.activeField{
input{
border: 2px solid #ced4da;
cursor: text;
}
}
.fetch{
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items:center;
margin:auto;
}
.home-btn {
background-color: #dc3545;
color: #fff;
padding: 10px;
border: none;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s ease;
margin:10px;
}
.home-btn:hover {
background-color: #c82333;
}
</style>
</head>
<body>
<div class="container">
<a href="adminDashboard.php"><button type="submit" class="home-btn">Home</button></a>
<?php
// Replace these values with your actual database credentials
include_once('db_connection_short.php');
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$id = $_POST['id'];
// Query to fetch data by ID
$sql = "SELECT * FROM users WHERE id = $id";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// Display form with fetched data
$row = $result->fetch_assoc();
?>
<h2>Data for ID: <?php echo $row['id']; ?></h2>
<form action="certInsertion.php" method="post">
<div class="form-group">
<label for="id">ID:</label>
<input type="text" id="id" name="id" value="<?php echo $row['id']; ?>" readonly>
</div>
<div class="form-group">
<label for="name">Name:</label>
<input type="text" id="name" name="name" value="<?php echo $row['name']; ?>" readonly>
</div>
<div class="form-group">
<label for="age">Age:</label>
<input type="text" id="age" name="age" value="<?php echo $row['age']; ?>" readonly>
</div>
<div class="form-group">
<label for="gender">Gender:</label>
<input type="text" id="gender" name="gender" value="<?php echo $row['gender']; ?>" readonly>
</div>
<div class="form-group">
<label for="blood_group">Blood Group:</label>
<input type="text" id="blood_group" name="blood_group" value="<?php echo $row['blood_group']; ?>" readonly>
</div>
<div class="form-group">
<label for="dob">DOB:</label>
<input type="text" id="dob" name="dob" value="<?php echo $row['dob']; ?>" readonly>
</div>
<div class="form-group">
<label for="mobile_number">Mobile Number:</label>
<input type="text" id="mobile_number" name="mobile_number" value="<?php echo $row['mobile_number']; ?>" readonly>
</div>
<div class="form-group">
<label for="email">Email:</label>
<input type="text" id="email" name="email" value="<?php echo $row['email']; ?>" readonly>
</div>
<div class="form-group">
<label for="city">City:</label>
<input type="text" id="city" name="city" value="<?php echo $row['city']; ?>" readonly>
</div>
<div class="form-group activeField">
<label for="receivers_name">Reciever's Name:</label>
<input type="text" id="receivers_name" name="receivers_name" required>
</div>
<!-- <div class="form_group"> -->
<input type="submit" value="Generate Certificate">
<!-- </div> -->
</form>
<br>
<?php
} else {
echo "<h2>No data found for ID: $id</h2>";
}
}
$conn->close();
?>
<form action="" method="post">
<div class="fetch activeField">
<label for="id">Enter ID:</label>
<input type="text" id="id" name="id" required>
<input type="submit" value="Fetch Data">
</div>
</form>
</div>
</body>
</html>