Career page mail code in php

Here is an example of a career page in PHP that allows users to search for job openings and apply for positions:

<?php

// Connect to the database
$conn = mysqli_connect("localhost", "username", "password", "database_name");

// Check connection
if (!$conn) {
    die("Connection failed: ". mysqli_connect_error());
}

// Define the job categories
$job_categories = array("Software Development", "Marketing", "Sales", "Customer Service", "Finance");

// Define the job types
$job_types = array("Full-time", "Part-time", "Contract", "Internship");

// Define the job status
$job_status = array("Open", "Closed");

// Get the job openings
$query = "SELECT * FROM jobs";
$result = mysqli_query($conn, $query);

// Create a table to display the job openings
echo "<table border='1'>";
echo "<tr><th>Job Title</th><th>Job Category</th><th>Job Type</th><th>Job Status</th><th>Location</th><th>Apply</th></tr>";

while ($row = mysqli_fetch_assoc($result)) {
    echo "<tr>";
    echo "<td>". $row["job_title"]. "</td>";
    echo "<td>". $row["job_category"]. "</td>";
    echo "<td>". $row["job_type"]. "</td>";
    echo "<td>". $row["job_status"]. "</td>";
    echo "<td>". $row["location"]. "</td>";
    echo "<td><a href='apply.php?id=". $row["id"]. "'>Apply</a></td>";
    echo "</tr>";
}

echo "</table>";

// Close the database connection
mysqli_close($conn);

?>

<!-- apply.php -->
<?php

// Connect to the database
$conn = mysqli_connect("localhost", "username", "password", "database_name");

// Check connection
if (!$conn) {
    die("Connection failed: ". mysqli_connect_error());
}

// Get the job ID from the URL
$id = $_GET["id"];

// Get the job details
$query = "SELECT * FROM jobs WHERE id = '$id'";
$result = mysqli_query($conn, $query);
$row = mysqli_fetch_assoc($result);

// Create a form to collect the applicant's information
echo "<form action='submit.php' method='post'>";
echo "<label>First Name:</label>";
echo "<input type='text' name='first_name'>";
echo "<br>";
echo "<label>Last Name:</label>";
echo "<input type='text' name='last_name'>";
echo "<br>";
echo "<label>Email:</label>";
echo "<input type='email' name='email'>";
echo "<br>";
echo "<label>Resume:</label>";
echo "<input type='file' name='resume'>";
echo "<br>";
echo "<input type='submit' value='Submit'>";
echo "</form>";

// Close the database connection
mysqli_close($conn);

?>

<!-- submit.php -->
<?php

// Connect to the database
$conn = mysqli_connect("localhost", "username", "password", "database_name");

// Check connection
if (!$conn) {
    die("Connection failed: ". mysqli_connect_error());
}

// Get the applicant's information
$first_name = $_POST["first_name"];
$last_name = $_POST["last_name"];
$email = $_POST["email"];
$resume = $_FILES["resume"];

// Upload the resume to the server
$upload_dir = "resumes/";
$filename = $upload_dir. $resume["name"];
move_uploaded_file($resume["tmp_name"], $filename);

// Insert the applicant's information into the database
$query = "INSERT INTO applicants (first_name, last_name, email, resume) VALUES ('$first_name', '$last_name', '$email', '$filename')";
mysqli_query($conn, $query);

// Send a confirmation email to the applicant
$to = $email;
$subject = "Job Application Confirmation";
$message = "Thank you for applying for the job. We will be in touch soon.";
mail($to, $subject, $message);

// Close the database connection
mysqli_close($conn);

?>

This code assumes that you have a database table called jobs that contains the job openings, and a table called applicants that will store the applicant's information. The code also assumes that you have a directory called resumes where you will store the uploaded resumes.

The career page allows users to search for job openings by category, type, and status. The page displays a table with the job openings, and each row includes a link to apply for the job. When a user clicks on the apply link, they are taken to a form where they can enter their information and upload their resume. The form is submitted to the submit.php page, which uploads the resume to the server and inserts the applicant's information into the database. Finally, the code sends a confirmation email to the applicant.

Note that this is just an example code and you should modify it to fit your specific needs. You may also want to add additional validation and error handling to ensure that the code works correctly.