Файловый менеджер - Редактировать - /home/d46091/invoice.ecogenix.in/company_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') { $c_name = $_POST['c_name']; $c_short = $_POST['c_short']; $c_address = $_POST['c_address']; $c_email = $_POST['c_email']; $c_mobile = $_POST['c_mobile']; $c_pincode = $_POST['c_pincode']; $c_gstin = $_POST['c_gstin']; $c_state = $_POST['c_state']; $c_inv = $_POST['c_inv']; $updated_at = date('Y-m-d H:i:s'); $stmt = $conn->prepare("UPDATE `company_master` SET `c_name` = ?, `c_short` = ?, `c_address` = ?, `c_email` = ?, `c_mobile` = ?, `c_pincode` = ?, `c_gstin` = ?, `c_state` = ?, `c_inv` = ?, `updated_at` = ? WHERE `id` = ?"); if ($stmt) { $stmt->bind_param("ssssssssssi", $c_name, $c_short, $c_address, $c_email, $c_mobile, $c_pincode, $c_gstin, $c_state, $c_inv, $updated_at, $id); if ($stmt->execute()) { echo "<script> alert('Company updated successfully!'); window.location.href = 'company.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 `company_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 Company Details</h2> <form method="POST"> <div class="mb-3"> <label for="c_name" class="form-label">Company Name</label> <input type="text" class="form-control" id="c_name" name="c_name" value="<?php echo htmlspecialchars($item['c_name']); ?>" required> </div> <div class="mb-3"> <label for="c_short" class="form-label">Short Code</label> <input type="text" class="form-control" id="c_short" name="c_short" value="<?php echo htmlspecialchars($item['c_short']); ?>" required> </div> <div class="mb-3"> <label for="c_address" class="form-label">Address</label> <textarea name="c_address" id="c_address" class="form-control"><?php echo htmlspecialchars($item['c_address']); ?></textarea> </div> <div class="mb-3"> <label for="c_email" class="form-label">Email</label> <input type="email" class="form-control" id="c_email" name="c_email" value="<?php echo htmlspecialchars($item['c_email']); ?>" required> </div> <div class="mb-3"> <label for="c_mobile" class="form-label">Mobile No.</label> <input type="text" class="form-control only-number" minlength="10" maxlength="10" id="c_mobile" name="c_mobile" value="<?php echo htmlspecialchars($item['c_mobile']); ?>" required> </div> <div class="mb-3"> <label for="c_pincode" class="form-label">Pincode</label> <input type="text" class="form-control only-number" minlength="6" maxlength="6" id="c_pincode" name="c_pincode" value="<?php echo htmlspecialchars($item['c_pincode']); ?>" required> </div> <div class="mb-3"> <label for="c_gstin" class="form-label">GSTIN</label> <input type="text" class="form-control" id="c_gstin" name="c_gstin" value="<?php echo htmlspecialchars($item['c_gstin']); ?>" required> </div> <div class="mb-3"> <label for="c_state" class="form-label">State Type</label> <select type="text" class="form-select" id="c_state" name="c_state"> <option value="" disabled <?php echo empty($item['c_state']) ? 'selected' : ''; ?>>--Select Type--</option> <option value="Intrastate" <?php echo ($item['c_state'] == 'Intrastate') ? 'selected' : ''; ?>>Intrastate</option> <option value="Outerstate" <?php echo ($item['c_state'] == 'Outerstate') ? 'selected' : ''; ?>>Outerstate</option> </select> </div> <div class="mb-3"> <label for="c_inv" class="form-label">INV Head</label> <input type="text" class="form-control" id="c_inv" name="c_inv" value="<?php echo htmlspecialchars($item['c_inv']); ?>" required> </div> <button type="submit" class="btn btn-primary">Update Company</button> <a href="company.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
|
Настройка