-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpostedjob.php
71 lines (64 loc) · 2.14 KB
/
postedjob.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
<?php
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
if (!isset($_SESSION['email'])) {
header('location:c_login.php');
}
$c_email = $_SESSION['email'];
$mysqli = new mysqli("localhost", "root", "", "jobportal");
if ($mysqli->connect_error) {
die("Connection failed: " . $mysqli->connect_error);
}
// Fetch the jobs posted by the company
$stmt = $mysqli->prepare("SELECT job_id, jobTitle, jobLocation, salaryRange, applicationDeadline, status FROM job WHERE c_email = ?");
$stmt->bind_param("s", $c_email);
$stmt->execute();
$result = $stmt->get_result();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Posted Jobs</title>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="job-list.css">
</head>
<body>
<div class="section">
<h2>Jobs Posted by You</h2>
<table>
<thead>
<tr>
<th>Job Title</th>
<th>Job Location</th>
<th>Salary</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
echo "<tr>";
echo "<td>" . $row['jobTitle'] . "</td>";
echo "<td>" . $row['jobLocation'] . "</td>";
echo "<td>" . $row['salaryRange'] . "</td>";
echo "<td>" . $row['status'] . "</td>";
echo "<td><a href='update_job.php?id=" . $row['job_id'] . "'>Update</a> | ";
echo "<a href='delete_job.php?id=" . $row['job_id'] . "' onclick='return confirm(\"Are you sure you want to delete this job?\")'>Delete</a></td>";
echo "</tr>";
}
} else {
echo "<tr><td colspan='6'>No jobs posted yet.</td></tr>";
}
$stmt->close();
$mysqli->close();
?>
</tbody>
</table>
</div>
</body>
</html>