setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['emiId'], $_POST['payStatus'])) { header('Content-Type: application/json'); ob_end_clean(); // Clears any accidental HTML output try { $stmt = $db->prepare("UPDATE emi SET payStatus = :payStatus WHERE customerId = :customerId AND id = :emiId"); $stmt->bindParam(':customerId', $_GET['customerId']); $stmt->bindParam(':payStatus', $_POST['payStatus'], PDO::PARAM_INT); $stmt->bindParam(':emiId', $_POST['emiId'], PDO::PARAM_INT); $stmt->execute(); echo json_encode(['status' => 'success']); } catch (PDOException $e) { echo json_encode(['status' => 'error', 'message' => $e->getMessage()]); } exit; } // Fetch EMI data $stmt = $db->prepare("SELECT * FROM emi WHERE customerId = :customerId AND invoiceId = :invoiceId ORDER BY emiDate ASC"); $stmt->bindParam(':customerId', $_GET['customerId']); $stmt->bindParam(':invoiceId', $_GET['invoiceId']); $stmt->execute(); $emiPlans = $stmt->fetchAll(PDO::FETCH_ASSOC); // var_dump($emiPlans); $stmt = $db->prepare("SELECT * FROM customers WHERE customerId = :customerId"); $stmt->bindParam(':customerId', $_GET['customerId']); $stmt->execute(); $customer = $stmt->fetch(PDO::FETCH_ASSOC); // var_dump($customer); } catch (PDOException $e) { die('
Error: ' . $e->getMessage() . '
'); } ?>

Installment Details

Customer Name:

Mobile Number:

Installment Start Date:

Invoice Id:

Total Amount: $

Outstanding: $

Tenure:

Frequency:

Installment Amount Date Payment Status Outstanding
$ $