Файловый менеджер - Редактировать - /home/d46091/invoice.ecogenix.in/index_edit.php
Назад
<?php require_once('includes/connection.php'); if (!isset($_GET['id']) || empty($_GET['id'])) { echo "Invalid item ID."; exit; } $id = intval($_GET['id']); // Handle form submission if ($_SERVER['REQUEST_METHOD'] == 'POST') { $item_name = $_POST['item_name']; $unit = $_POST['unit']; $hsn = $_POST['hsn']; $cgst = $_POST['cgst']; $sgst = $_POST['sgst']; $igst = $_POST['igst']; $description = $_POST['description']; // $status = $_POST['status']; $updated_at = date('Y-m-d H:i:s'); $stmt = $conn->prepare("UPDATE `item_master` SET `item_name` = ?, `unit` = ?, `hsn` = ?, `cgst` = ?, `sgst` = ?, `igst` = ?, `description` = ?, `updated_at` = ? WHERE `id` = ?"); if ($stmt) { $stmt->bind_param("ssssssssi", $item_name, $unit, $hsn, $cgst, $sgst, $igst, $description, $updated_at, $id); if ($stmt->execute()) { echo "<script> alert('Item updated successfully!'); window.location.href = 'dashboard.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 `item_master` WHERE `id` = ?"); $stmt->bind_param("i", $id); $stmt->execute(); $result = $stmt->get_result(); if ($result->num_rows === 0) { echo "Item not found."; exit; } $item = $result->fetch_assoc(); $stmt->close(); require_once('includes/header.php'); ?> <div class="content"> <div class="container mt-4"> <h2>Edit Item</h2> <form method="POST"> <div class="row"> <div class="col-md-3"> <div class="mb-3"> <label for="item_name" class="form-label">Item Name</label> <input type="text" class="form-control" id="item_name" name="item_name" value="<?php echo htmlspecialchars($item['item_name']); ?>" required> </div> </div> <div class="col-md-3"> <div class="mb-3"> <label for="unit" class="form-label">Unit</label> <input type="text" class="form-control" id="unit" name="unit" value="<?php echo htmlspecialchars($item['unit']); ?>" required> </div> </div> <div class="col-md-3"> <div class="mb-3"> <label for="hsn" class="form-label">HSN Code</label> <input type="text" class="form-control" id="hsn" name="hsn" value="<?= htmlspecialchars($item['hsn']) ?>" required> </div> </div> <div class="col-md-3"> <div class="mb-3"> <label for="cgst" class="form-label">CGST</label> <input type="number" class="form-control" id="cgst" name="cgst" value="<?= htmlspecialchars($item['cgst']) ?>" minlength="1" maxlength="2" required> </div> </div> <div class="col-md-3"> <div class="mb-3"> <label for="sgst" class="form-label">SGST</label> <input type="number" class="form-control" id="sgst" name="sgst" value="<?= htmlspecialchars($item['sgst']) ?>" minlength="1" maxlength="2" required> </div> </div> <div class="col-md-3"> <div class="mb-3"> <label for="igst" class="form-label">IGST</label> <input type="number" class="form-control" id="igst" name="igst" value="<?= htmlspecialchars($item['igst']) ?>" minlength="1" maxlength="2" required> </div> </div> <div class="col-md-6"> <div class="mb-3"> <label for="description" class="form-label">Special Note (It Will be appear on Invoice)</label> <textarea name="description" id="description" class="form-control"><?php echo htmlspecialchars($item['description']); ?></textarea> </div> </div> <!-- <div class="mb-3"> <label for="status" class="form-label">Status</label> <select class="form-select" id="status" name="status" required> <option value="1" <?php echo ($item['status'] == 1) ? 'selected' : ''; ?>>Active</option> <option value="0" <?php echo ($item['status'] == 0) ? 'selected' : ''; ?>>Deactive</option> </select> </div> --> <div class="col-md-3"> <button type="submit" class="btn btn-primary">Update Item</button> <a href="index.php" class="btn btn-secondary">Cancel</a> </div> </div> </form> </div> </div> <?php require_once('includes/footer.php'); ?>
| ver. 1.4 |
Github
|
.
| PHP 8.1.32 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка