✅ Next Module: Job Postings and
Applications
🎯 Purpose:
To allow employers to
post job openings and job seekers to search and apply for those jobs.
✅ Functionalities to Implement:
🔹 For Employers:
- ➕ Post new
job openings
- 📋
View all posted jobs
- 📝
Edit/Delete job posts
- 👀
View applications received per job
🔹 For Job Seekers:
- 🔍
Search and filter jobs (by category, location, salary, etc.)
- 👁️
View detailed job descriptions
- 📄
Apply to jobs with resume and cover letter
- 📜
View status of applications (Pending, Reviewed, Selected, Rejected)
📁 Suggested File/Folder
Structure:
/jobs/
├── post_job.php # Form to post a new job
(employer)
├── job_list.php # List of all jobs (job seeker)
├── view_job.php # Detailed view of a job
├── apply_job.php # Job application form
├── my_applications.php # View applications (job seeker)
├── applications_received.php # Employers see who
applied
🧮 Suggested Database
Tables:
1. jobs
CREATE TABLE jobs (
id INT AUTO_INCREMENT PRIMARY KEY,
employer_id INT NOT NULL,
title VARCHAR(255) NOT NULL,
description TEXT NOT NULL,
location VARCHAR(255),
salary VARCHAR(50),
job_type ENUM('Full-Time', 'Part-Time', 'Internship',
'Remote'),
posted_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (employer_id) REFERENCES
users(id)
);
2. applications
CREATE TABLE applications
(
id INT AUTO_INCREMENT PRIMARY KEY,
job_id INT NOT NULL,
seeker_id INT NOT NULL,
resume VARCHAR(255), -- (file path or
upload link)
cover_letter TEXT,
status ENUM('Pending', 'Reviewed', 'Selected',
'Rejected') DEFAULT 'Pending',
applied_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (job_id) REFERENCES jobs(id),
FOREIGN KEY (seeker_id) REFERENCES
users(id)
);
1️⃣ post_job.php
(Form to post a new job —
for Employers)
<?php
include '../config.php'; //
Your database connection
session_start();
if ($_SERVER['REQUEST_METHOD']
== 'POST') {
$employer_id = $_SESSION['user_id']; //
assuming employer is logged in
$title = $_POST['title'];
$description = $_POST['description'];
$location = $_POST['location'];
$salary = $_POST['salary'];
$job_type = $_POST['job_type'];
$query = "INSERT INTO jobs
(employer_id, title, description, location, salary, job_type)
VALUES ('$employer_id', '$title', '$description', '$location', '$salary', '$job_type')";
if (mysqli_query($conn, $query)) {
echo "Job Posted
Successfully!";
} else {
echo "Error: " . mysqli_error($conn);
}
}
?>
<h2>Post a New
Job</h2>
<form method="POST">
Title: <input type="text"
name="title" required><br>
Description:<br>
<textarea name="description"
required></textarea><br>
Location: <input type="text"
name="location"><br>
Salary: <input type="text"
name="salary"><br>
Job Type:
<select name="job_type"
required>
<option value="Full-Time">Full-Time</option>
<option value="Part-Time">Part-Time</option>
<option value="Internship">Internship</option>
<option value="Remote">Remote</option>
</select><br>
<button type="submit">Post
Job</button>
</form>
2️⃣ job_list.php
(List of all jobs — for
Job Seekers)
<?php
include '../config.php';
$result = mysqli_query($conn,
"SELECT * FROM jobs ORDER BY posted_at DESC");
?>
<h2>Available
Jobs</h2>
<ul>
<?php while ($job = mysqli_fetch_assoc($result))
{ ?>
<li>
<strong><?php echo $job['title'];
?></strong> — <?php echo $job['location']; ?><br>
<a href="view_job.php?id=<?php
echo $job['id']; ?>">View Details</a>
</li>
<?php } ?>
</ul>
3️⃣ view_job.php
(Detailed view of a job)
<?php
include '../config.php';
if (isset($_GET['id'])) {
$id = $_GET['id'];
$result = mysqli_query($conn, "SELECT
* FROM jobs WHERE id = $id");
$job = mysqli_fetch_assoc($result);
}
?>
<?php if ($job) { ?>
<h2><?php echo $job['title']; ?></h2>
<p><?php echo $job['description'];
?></p>
<p><strong>Location:</strong> <?php echo $job['location'];
?></p>
<p><strong>Salary:</strong> <?php echo $job['salary'];
?></p>
<p><strong>Type:</strong>
<?php echo $job['job_type']; ?></p>
<a href="apply_job.php?job_id=<?php
echo $job['id']; ?>">Apply Now</a>
<?php } else { ?>
<p>Job not found.</p>
<?php } ?>
4️⃣ apply_job.php
(Job Application Form)
<?php
include '../config.php';
session_start();
if ($_SERVER['REQUEST_METHOD']
== 'POST') {
$job_id = $_POST['job_id'];
$seeker_id = $_SESSION['user_id']; //
assuming job seeker is logged in
$resume = $_POST['resume']; // In real-world, handle file upload
$cover_letter = $_POST['cover_letter'];
$query = "INSERT INTO applications
(job_id, seeker_id, resume, cover_letter)
VALUES ('$job_id', '$seeker_id', '$resume', '$cover_letter')";
if (mysqli_query($conn, $query)) {
echo "Application Submitted!";
} else {
echo "Error: " . mysqli_error($conn);
}
}
?>
<h2>Apply for
Job</h2>
<form method="POST">
<input type="hidden" name="job_id"
value="<?php echo $_GET['job_id']; ?>">
Resume (File Path): <input type="text"
name="resume" required><br>
Cover Letter:<br>
<textarea name="cover_letter"
required></textarea><br>
<button type="submit">Submit
Application</button>
</form>
5️⃣ my_applications.php
(View Applications — for
Job Seekers)
<?php
include '../config.php';
session_start();
$seeker_id = $_SESSION['user_id'];
$result = mysqli_query($conn,
"SELECT a.*, j.title
FROM applications a
JOIN jobs j ON a.job_id = j.id
WHERE a.seeker_id = $seeker_id"
);
?>
<h2>My
Applications</h2>
<ul>
<?php while ($row = mysqli_fetch_assoc($result))
{ ?>
<li>
<strong>Job:</strong> <?php
echo $row['title']; ?><br>
<strong>Status:</strong> <?php
echo $row['status']; ?><br>
<strong>Applied
At:</strong> <?php echo $row['applied_at']; ?><br>
</li>
<?php } ?>
</ul>
6️⃣ applications_received.php
(Employers see who
applied)
<?php
include '../config.php';
session_start();
$employer_id = $_SESSION['user_id'];
$result = mysqli_query($conn,
"SELECT a.*, j.title, u.name as
seeker_name
FROM applications a
JOIN jobs j ON a.job_id = j.id
JOIN users u ON a.seeker_id = u.id
WHERE j.employer_id = $employer_id"
);
?>
<h2>Applications
Received</h2>
<ul>
<?php while ($row = mysqli_fetch_assoc($result))
{ ?>
<li>
<strong>Job:</strong> <?php
echo $row['title']; ?><br>
<strong>Applicant:</strong>
<?php echo $row['seeker_name']; ?><br>
<strong>Status:</strong> <?php
echo $row['status']; ?><br>
<strong>Applied
At:</strong> <?php echo $row['applied_at']; ?><br>
</li>
<?php } ?>
</ul>
🔑 4️⃣ login.php — Login Script(Add this code with existing login.php code)
<?php
include 'config.php';
session_start();
if ($_SERVER['REQUEST_METHOD']
== 'POST') {
$email = $_POST['email'];
$password = $_POST['password'];
$result = mysqli_query($conn, "SELECT
* FROM users WHERE email = '$email'");
$user = mysqli_fetch_assoc($result);
if ($user && password_verify($password,
$user['password'])) {
$_SESSION['user_id'] = $user['id'];
$_SESSION['role'] = $user['role'];
$_SESSION['name'] = $user['name'];
if ($user['role'] == 'Employer') {
header("Location:
employer_dashboard.php");
} else {
header("Location:
seeker_dashboard.php");
}
exit;
} else {
echo "Invalid email or
password.";
}
}
?>
<h2>Login</h2>
<form method="POST">
Email: <input type="email"
name="email" required><br>
Password: <input type="password"
name="password" required><br>
<button type="submit">Login</button>
</form>
🏠 6️⃣ Example Dashboards:
employer_dashboard.php
<?php
session_start();
if (!isset($_SESSION['user_id'])
|| $_SESSION['role'] != 'Employer') {
header('Location: login.php');
exit;
}
echo "<h2>Welcome,
Employer " . $_SESSION['name'] . "</h2>";
echo "<a
href='jobs/post_job.php'>Post a Job</a> | <a
href='jobs/applications_received.php'>View Applications</a> | <a
href='logout.php'>Logout</a>";
?>
seeker_dashboard.php
<?php
session_start();
if (!isset($_SESSION['user_id'])
|| $_SESSION['role'] != 'Seeker') {
header('Location: login.php');
exit;
}
echo "<h2>Welcome,
Job Seeker " . $_SESSION['name'] . "</h2>";
echo "<a
href='jobs/job_list.php'>View Jobs</a> | <a
href='jobs/my_applications.php'>My Applications</a> | <a
href='logout.php'>Logout</a>";
?>
✅ Summary:
- They log in through login.php.
- Based
on role they are redirected to their respective dashboards.
- Simple
session-based authentication.