📁 File Manager
Editing:
/home/wvl7mof7402e/public_html/remindyourdata.live/admin/demand.php
<?php require("dbconnect.php"); if ($_SERVER['REQUEST_METHOD'] == 'POST') { // Insert Header $title = $_POST['title']; $company_name = $_POST['company_name']; $visa_type = $_POST['visa_type']; $selection_type = $_POST['selection_type']; // Logo upload $logo_left = $_FILES['logo_left']['name']; $logo_right = $_FILES['logo_right']['name']; if($logo_left) move_uploaded_file($_FILES['logo_left']['tmp_name'], "uploads/".$logo_left); if($logo_right) move_uploaded_file($_FILES['logo_right']['tmp_name'], "uploads/".$logo_right); $con->query("INSERT INTO demand_header (title, company_name, visa_type, selection_type, logo_left, logo_right) VALUES ('$title','$company_name','$visa_type','$selection_type','$logo_left','$logo_right')"); $demand_id = $con->insert_id; // Insert Trades foreach($_POST['trade'] as $i => $trade){ $qty = $_POST['qty'][$i]; $salary = $_POST['salary'][$i]; if($trade!=""){ $con->query("INSERT INTO demand_trades (demand_id, trade, qty, salary) VALUES ($demand_id,'$trade','$qty','$salary')"); } } // Insert Terms $duty_hours = $_POST['duty_hours']; $age_limit = $_POST['age_limit']; $contract = $_POST['contract_period']; $medical = $_POST['medical']; $accommodation = $_POST['accommodation']; $con->query("INSERT INTO demand_terms (demand_id, duty_hours, age_limit, contract_period, medical, accommodation) VALUES ($demand_id,'$duty_hours','$age_limit','$contract','$medical','$accommodation')"); // Insert Footer $agency_name = $_POST['agency_name']; $address = $_POST['address']; $phone = $_POST['phone']; $email = $_POST['email']; $agency_logo = $_FILES['agency_logo']['name']; if($agency_logo) move_uploaded_file($_FILES['agency_logo']['tmp_name'], "uploads/".$agency_logo); $con->query("INSERT INTO demand_footer (demand_id, agency_name, agency_logo, address, phone, email) VALUES ($demand_id,'$agency_name','$agency_logo','$address','$phone','$email')"); echo "<div class='alert alert-success mt-3'>? Demand Inserted Successfully <a href='dgenerate_pdf.php?id=$demand_id' class='btn btn-sm btn-dark'>Download PDF</a></div>"; } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <title>Create Demand</title> <!-- Bootstrap CSS --> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" /> <!-- Bootstrap Icons --> <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css" rel="stylesheet" /> <style> body { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); min-height: 100vh; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; padding: 20px 10px; } .container { max-width: 960px; background: #ffffffee; padding: 30px 35px; margin: auto; border-radius: 15px; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15); } h2 { text-align: center; margin-bottom: 30px; color: #3b3b3b; font-weight: 700; font-size: 2.5rem; letter-spacing: 1.2px; } h2::before { content: "\f4c4"; /* bi-file-earmark-text icon */ font-family: "Bootstrap Icons"; margin-right: 10px; color: #764ba2; font-weight: 700; font-size: 2.7rem; vertical-align: middle; } .form-section { background: #f8f9fa; padding: 25px 25px 30px; border-radius: 12px; margin-bottom: 30px; box-shadow: 0 3px 8px rgb(0 0 0 / 0.07); } .form-section h3 { font-size: 1.8rem; margin-bottom: 20px; color: #5a5a5a; border-left: 5px solid #764ba2; padding-left: 12px; font-weight: 600; display: flex; align-items: center; gap: 10px; } .form-section h3 i { font-size: 1.5rem; color: #764ba2; } label { font-weight: 600; color: #444; } input.form-control, textarea.form-control { border-radius: 8px; border: 1.8px solid #ccc; transition: border-color 0.3s ease; } input.form-control:focus, textarea.form-control:focus { border-color: #764ba2; box-shadow: 0 0 8px #b092dbaa; outline: none; } table th, table td { vertical-align: middle; text-align: center; } table.table-bordered { border: 2px solid #ddd; border-radius: 12px; overflow: hidden; } table.table-bordered th { background: #764ba2; color: #fff; font-weight: 600; border: none; } table.table-bordered td { border-top: 1px solid #ddd; } .btn-primary { background: #764ba2; border: none; width: 100%; padding: 14px; font-size: 18px; font-weight: 600; border-radius: 10px; transition: background 0.3s ease; display: flex; justify-content: center; align-items: center; gap: 10px; } .btn-primary:hover { background: #5a3680; } .btn-sm { font-weight: 600; border-radius: 8px; } .btn-sm.btn-success { background-color: #28a745; border: none; font-size: 14px; padding: 6px 12px; display: flex; align-items: center; gap: 6px; transition: background-color 0.3s ease; } .btn-sm.btn-success:hover { background-color: #218838; } .btn-sm.btn-danger { background-color: #dc3545; border: none; font-size: 14px; padding: 6px 12px; display: flex; align-items: center; gap: 6px; transition: background-color 0.3s ease; } .btn-sm.btn-danger:hover { background-color: #bb2d3b; } .alert { border-radius: 10px; font-weight: 600; font-size: 1.1rem; margin-top: 20px; display: flex; justify-content: space-between; align-items: center; gap: 20px; } .alert a.btn { width: auto; padding: 6px 16px; font-size: 14px; background-color: #343a40; } @media (max-width: 767px) { .container { padding: 20px 15px; width: 95%; } h2 { font-size: 2rem; } .form-section h3 { font-size: 1.4rem; } .btn-primary { font-size: 16px; padding: 12px; } table.table-bordered th, table.table-bordered td { font-size: 14px; padding: 8px 6px; } } </style> </head> <body> <p><a href="logout.php" class="logout-btn" aria-label="Logout" style="color:#FFFFFF"> <i class="bi bi-box-arrow-right"></i> Logout </a></p> <div class="container"> <h2>Create New Demand</h2> <form method="post" enctype="multipart/form-data"> <div class="form-section"> <h3><i class="bi bi-card-list"></i> Header Information</h3> <div class="row g-3"> <div class="col-md-6"> <label for="title" class="form-label">Title <sup class="text-danger">*</sup></label> <input type="text" id="title" name="title" class="form-control" required placeholder="Enter demand title"> </div> <div class="col-md-6"> <label for="company_name" class="form-label">Company Name</label> <input type="text" id="company_name" name="company_name" class="form-control" placeholder="Enter company name"> </div> <div class="col-md-6"> <label for="visa_type" class="form-label">Visa Type</label> <input type="text" id="visa_type" name="visa_type" class="form-control" placeholder="Enter visa type"> </div> <div class="col-md-6"> <label for="selection_type" class="form-label">Selection Type</label> <input type="text" id="selection_type" name="selection_type" class="form-control" placeholder="Enter selection type"> </div> <div class="col-md-6"> <label for="logo_left" class="form-label">Left Logo</label> <input type="file" id="logo_left" name="logo_left" class="form-control" accept="image/*"> </div> <div class="col-md-6"> <label for="logo_right" class="form-label">Right Logo</label> <input type="file" id="logo_right" name="logo_right" class="form-control" accept="image/*"> </div> </div> </div> <div class="form-section"> <h3><i class="bi bi-briefcase-fill"></i> Trades</h3> <table class="table table-bordered" id="tradesTable"> <thead class="table-light"> <tr> <th>Trade</th> <th>Quantity</th> <th>Salary</th> <th>Action</th> </tr> </thead> <tbody> <tr> <td><input type="text" name="trade[]" class="form-control" placeholder="Trade name"></td> <td><input type="number" name="qty[]" class="form-control" placeholder="Qty"></td> <td><input type="text" name="salary[]" class="form-control" placeholder="Salary"></td> <td> <button type="button" class="btn btn-sm btn-danger removeRow" title="Remove Row"> <i class="bi bi-trash-fill"></i> </button> </td> </tr> </tbody> </table> <button type="button" class="btn btn-sm btn-success" id="addRow" title="Add Row"> <i class="bi bi-plus-lg"></i> Add Row </button> </div> <div class="form-section"> <h3><i class="bi bi-card-checklist"></i> Terms & Conditions</h3> <div class="row g-3"> <div class="col-md-6"> <label for="duty_hours" class="form-label">Duty Hours</label> <input type="text" id="duty_hours" name="duty_hours" class="form-control" placeholder="e.g. 8 hours/day"> </div> <div class="col-md-6"> <label for="age_limit" class="form-label">Age Limit</label> <input type="text" id="age_limit" name="age_limit" class="form-control" placeholder="e.g. 21-35 years"> </div> <div class="col-md-6"> <label for="contract_period" class="form-label">Contract Period</label> <input type="text" id="contract_period" name="contract_period" class="form-control" placeholder="e.g. 2 years"> </div> <div class="col-md-6"> <label for="medical" class="form-label">Medical</label> <input type="text" id="medical" name="medical" class="form-control" placeholder="Medical requirements"> </div> <div class="col-md-6"> <label for="accommodation" class="form-label">Accommodation</label> <input type="text" id="accommodation" name="accommodation" class="form-control" placeholder="Accommodation details"> </div> </div> </div> <div class="form-section"> <h3><i class="bi bi-building"></i> Footer (Agency Info)</h3> <div class="row g-3"> <div class="col-md-6"> <label for="agency_name" class="form-label">Agency Name</label> <input type="text" id="agency_name" name="agency_name" class="form-control" placeholder="Agency name"> </div> <div class="col-md-6"> <label for="agency_logo" class="form-label">Agency Logo</label> <input type="file" id="agency_logo" name="agency_logo" class="form-control" accept="image/*"> </div> <div class="col-md-12"> <label for="address" class="form-label">Address</label> <textarea id="address" name="address" class="form-control" rows="2" placeholder="Agency address"></textarea> </div> <div class="col-md-6"> <label for="phone" class="form-label">Phone</label> <input type="text" id="phone" name="phone" class="form-control" placeholder="+123 456 7890"> </div> <div class="col-md-6"> <label for="email" class="form-label">Email</label> <input type="email" id="email" name="email" class="form-control" placeholder="email@example.com"> </div> </div> </div> <button type="submit" class="btn btn-primary"> <i class="bi bi-save2-fill"></i> Save Demand </button> </form> </div> <!-- Bootstrap + JS --> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script> <script> document.getElementById("addRow").addEventListener("click", function(){ let table = document.querySelector("#tradesTable tbody"); let newRow = document.createElement("tr"); newRow.innerHTML = ` <td><input type="text" name="trade[]" class="form-control" placeholder="Trade name"></td> <td><input type="number" name="qty[]" class="form-control" placeholder="Qty"></td> <td><input type="text" name="salary[]" class="form-control" placeholder="Salary"></td> <td> <button type="button" class="btn btn-sm btn-danger removeRow" title="Remove Row"> <i class="bi bi-trash-fill"></i> </button> </td> `; table.appendChild(newRow); }); document.addEventListener("click", function(e){ if(e.target.closest(".removeRow")){ e.target.closest("tr").remove(); } }); </script> </body> </html>
Save
Cancel