home/abhiramc/public_html/acts.service/dashboard.location.reg.php000064400000025521150211473230021163 0ustar00getConnection(); $off = new office($db); $stmtoff = $off->off_read(); $numoff = $stmtoff->rowCount(); // Check if the form has been submitted if (isset($_POST['save'])) { // Capture the form data $branch_id = $_POST['offbranch']; $location = $_POST['lo_name']; // Check if the branch is selected and location is entered if ($branch_id != '-1' && !empty($location)) { // Prepare the query to insert data into acts_location table $query = "INSERT INTO acts_location (branch_id, lo_name) VALUES (:branch_id, :lo_name)"; // Prepare statement $stmt = $db->prepare($query); // Bind the parameters $stmt->bindParam(':branch_id', $branch_id); $stmt->bindParam(':lo_name', $location); // Execute the query if ($stmt->execute()) { // Success: Data saved successfully echo ""; } else { // Error: Failed to insert data echo ""; } } else { // Error: Validation failed echo ""; } } ?> STATS
Selected Branch
Total Employees: 0
Add New Employee
prepare($query); $stmt->bindParam(':branch_id', $branch_id); $stmt->execute(); $locations = $stmt->fetchAll(PDO::FETCH_ASSOC); if ($locations) { echo"
"; echo ""; foreach ($locations as $location) { $branchQuery = "SELECT brch_name FROM acts_branch WHERE brch_id = :branch_id"; $branchStmt = $db->prepare($branchQuery); $branchStmt->bindParam(':branch_id', $location['branch_id']); $branchStmt->execute(); $branchData = $branchStmt->fetch(PDO::FETCH_ASSOC); echo ""; } echo "
Office Name Location Name Action
" . $branchData['brch_name'] . " " . $location['lo_name'] . "
"; echo "
"; } else { echo "
No location found for this office.
"; } } else { echo "
Please select an office.
"; } } else { echo "

No results to display!

"; } if (isset($_GET['delete'])) { $location_id = $_GET['delete']; $deleteQuery = "DELETE FROM acts_location WHERE lo_id = :location_id"; $deleteStmt = $db->prepare($deleteQuery); $deleteStmt->bindParam(':location_id', $location_id); if ($deleteStmt->execute()) { echo ""; } else { echo ""; } } ?>

Add New Location