File manager - Edit - /home/monara/public_html/BenHoldings_web/assets/php/add_job.php
Back
<?php include 'config.php'; if ($_SERVER['REQUEST_METHOD'] == 'POST') { $category = $_POST['category']; $title = $_POST['title']; $description = $_POST['description']; // Handle file upload $image = $_FILES['image']['name']; $target = "uploads/" . basename($image); // Attempt to upload the file if (move_uploaded_file($_FILES['image']['tmp_name'], $target)) { // Prepare and bind the statement $stmt = $conn->prepare("INSERT INTO jobs (category, title, image, description) VALUES (?, ?, ?, ?)"); $stmt->bind_param("ssss", $category, $title, $image, $description); // Execute the statement if ($stmt->execute()) { header("Location: admin.php"); exit(); } else { echo "Error: " . $stmt->error; } } else { echo "Failed to upload image."; } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Add Job</title> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css"> </head> <body> <div class="container mt-4"> <h2>Add New Vacancy</h2> <form method="post" enctype="multipart/form-data"> <div class="mb-3"> <label>Category</label> <select name="category" class="form-control" required> <option value="">Select Category</option> <option value="IT">IT</option> <option value="Finance">Finance</option> <option value="Marketing">Marketing</option> <option value="HR">HR</option> <option value="Other">Other</option> </select> </div> <div class="mb-3"> <label>Title</label> <input type="text" name="title" class="form-control" required> </div> <div class="mb-3"> <label>Image</label> <input type="file" name="image" class="form-control" required> </div> <div class="mb-3"> <label>Description</label> <textarea name="description" class="form-control" required></textarea> </div> <button type="submit" class="btn btn-primary">Add Job</button> </form> </div> </body> </html>
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings