-
Notifications
You must be signed in to change notification settings - Fork 0
/
certList.php
118 lines (101 loc) · 3.27 KB
/
certList.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
<?php
session_start();
include_once('db_connection_short.php');
// Create a connection
$conn = new mysqli($servername, $db_username, $db_password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>View Certificates</title>
<style>
body {
font-family: 'Arial', sans-serif;
background-color: #f8f9fa;
margin: 25px;
padding: 0;
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: flex-start;
}
.certificate-box {
background-color: #ffffff;
border: 1px solid #ced4da;
border-radius: 18px;
padding: 25px;
box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
margin: 10px;
width: calc(50% - 20px);
box-sizing: border-box;
transition: background-color 0.3s ease, color 0.3s ease; /* Add transition for hover effect */
}
.certificate-box:hover {
background-color: #007bff; /* Change background color on hover */
color: #fff; /* Change text color on hover */
box-shadow: 0 0 25px rgba(245, 246, 240, 0.5);
h2{
color:white;
}
button{
background-color:white;
color:#007bff
}
}
h2 {
color: #007bff;
margin-bottom: 10px;
}
p {
margin-bottom: 10px;
}
.view-button {
background-color: #007bff;
color: #fff;
padding: 10px;
border: none;
border-radius: 4px;
cursor: pointer;
transition: background-color 0.3s ease; /* Add transition for hover effect */
}
</style>
</head>
<body>
<?php
//include_once('db_connection.php');
$user_id=$_SESSION['id'];
// Fetch data from the database
$sql = "SELECT * FROM certificates WHERE user_id=$user_id";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
?>
<div class="certificate-box">
<h2>Certificate ID: <?php echo $row['certificate_id']; ?></h2>
<p>User ID: <?php echo $row['user_id']; ?></p>
<p>Issue Date: <?php echo $row['issue_date']; ?></p>
<p>Receiver's Name: <?php echo $row['receivers_name']; ?></p>
<form id="viewCertificateForm" action="cert.php" method="post">
<!-- Hidden input field to store receivers_name -->
<input type="hidden" name="receivers_name" value="<?php echo $row['receivers_name']; ?>">
<!-- View Certificate button -->
<button type="submit" class="view-button">View Certificate</button>
</form>
</div>
<?php
}
} else {
echo "<p>No certificates found.</p>";
echo "<br>";
echo "<button> Book Appointment </button>";
}
$conn->close();
?>
</body>
</html>