0) { // Query to get job details by job_id $sql = "SELECT * FROM job_postings WHERE job_id = ?"; $stmt = $conn->prepare($sql); $stmt->bind_param("i", $job_id); $stmt->execute(); $result = $stmt->get_result(); // Check if the job exists if ($result->num_rows > 0) { $job = $result->fetch_assoc(); } else { echo "Job not found."; exit(); } } else { echo "Invalid job ID."; exit(); } // Check if the logged-in user is a job seeker $is_job_seeker = ($_SESSION['user_type'] === 'Job seeker'); // Handle job application if (isset($_POST['apply']) && $is_job_seeker) { // Get seeker_id from session $seeker_id = $_SESSION['seeker_id']; $application_date = date('Y-m-d H:i:s'); // Current date and time $status = 'Pending'; // Default status // Insert the application into the applications table $sql_apply = "INSERT INTO applications (job_id, seeker_id, application_date, status) VALUES (?, ?, ?, ?)"; $stmt_apply = $conn->prepare($sql_apply); $stmt_apply->bind_param("iiss", $job_id, $seeker_id, $application_date, $status); if ($stmt_apply->execute()) { $application_message = "You have successfully applied for this job!"; } else { $application_message = "There was an error while applying. Please try again later."; } } ?> Job Details

Job Description

Posted on:
close(); ?>