Файловый менеджер - Редактировать - /home/d46091/invoice.ecogenix.in/customer_edit.php
Назад
<?php require_once('includes/connection.php'); if (!isset($_GET['id']) || empty($_GET['id'])) { echo "Invalid customer ID."; exit; } $id = intval($_GET['id']); // Handle form submission if ($_SERVER['REQUEST_METHOD'] == 'POST') { $cus_name = $_POST['cus_name']; $cus_address = $_POST['cus_address']; $cus_destination = $_POST['cus_destination']; $cus_state = $_POST['cus_state']; $updated_at = date('Y-m-d H:i:s'); $stmt = $conn->prepare("UPDATE `customer_master` SET `cus_name` = ?, `cus_address` = ?, `cus_destination` = ?, `cus_state` = ?, `updated_at` = ? WHERE `id` = ?"); if ($stmt) { $stmt->bind_param("sssssi", $cus_name, $cus_address, $cus_destination, $cus_state, $updated_at, $id); if ($stmt->execute()) { echo "<script> alert('Customer updated successfully!'); window.location.href = 'customer.php'; </script>"; } else { echo "Error updating record: " . $stmt->error; } $stmt->close(); } else { echo "Failed to prepare statement: " . $conn->error; } exit; } // Fetch existing data $stmt = $conn->prepare("SELECT * FROM `customer_master` WHERE `id` = ?"); $stmt->bind_param("i", $id); $stmt->execute(); $result = $stmt->get_result(); if ($result->num_rows === 0) { echo "Customer not found."; exit; } $customer = $result->fetch_assoc(); $stmt->close(); require_once('includes/header.php'); ?> <div class="content"> <div class="container mt-4"> <h2>Edit Customer</h2> <form method="POST"> <div class="mb-3"> <label for="cus_name" class="form-label">Customer Name</label> <input type="text" class="form-control" id="cus_name" name="cus_name" value="<?php echo htmlspecialchars($customer['cus_name']); ?>" required> </div> <div class="mb-3"> <label for="cus_address" class="form-label">Address</label> <textarea name="cus_address" id="cus_address" class="form-control" required><?php echo htmlspecialchars($customer['cus_address']); ?></textarea> </div> <div class="mb-3"> <label for="cus_destination" class="form-label">Destination</label> <input type="text" class="form-control" id="cus_destination" name="cus_destination" value="<?php echo htmlspecialchars($customer['cus_destination']); ?>" required> </div> <div class="mb-3"> <label for="cus_state" class="form-label">State Type</label> <select type="text" class="form-select" id="cus_state" name="cus_state"> <option value="" disabled <?php echo empty($customer['cus_state']) ? 'selected' : ''; ?>>--Select Type--</option> <option value="Intrastate" <?php echo ($customer['cus_state'] == 'Intrastate') ? 'selected' : ''; ?>>Intrastate</option> <option value="Outerstate" <?php echo ($customer['cus_state'] == 'Outerstate') ? 'selected' : ''; ?>>Outerstate</option> </select> </div> <button type="submit" class="btn btn-primary">Update Customer</button> <a href="customer.php" class="btn btn-secondary">Cancel</a> </form> </div> </div> <?php require_once('includes/footer.php'); ?>
| ver. 1.4 |
Github
|
.
| PHP 8.1.32 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка