:: **Zploit** v1.0 | Current Path: **/home/kreativepixelz/www/sukhadaworldapp/admin/**
:: Editing File: offer_edit.php
<?php require_once 'db.php'; require_once 'session.php'; include "header.php"; // ✅ 1. Validate Offer ID if (!isset($_GET['id']) || empty($_GET['id'])) { $_SESSION['error'] = "Error: Offer ID is missing."; header("Location: offer.php"); exit; } $offer_id = (int)$_GET['id']; // ✅ 2. Fetch Offer Data $sql = "SELECT * FROM offers WHERE id = ?"; $stmt = mysqli_prepare($conn, $sql); if ($stmt) { mysqli_stmt_bind_param($stmt, "i", $offer_id); mysqli_stmt_execute($stmt); $result = mysqli_stmt_get_result($stmt); $offer = mysqli_fetch_assoc($result); mysqli_stmt_close($stmt); if (!$offer) { $_SESSION['error'] = "Error: Offer record not found."; header("Location: offer.php"); exit; } } else { $_SESSION['error'] = "Database error."; header("Location: offer.php"); exit; } ?> <!-- Page Wrapper --> <div class="page-content-wrapper"> <div class="page-content"> <!-- Breadcrumb --> <div class="page-breadcrumb d-none d-sm-flex align-items-center mb-3"> <div class="breadcrumb-title pe-3">Offer</div> <div class="ps-3"> <nav aria-label="breadcrumb"> <ol class="breadcrumb mb-0 p-0 align-items-center"> <li class="breadcrumb-item"> <a href="dashboard.php"> <ion-icon name="home-outline"></ion-icon> </a> </li> <li class="breadcrumb-item active">Edit Offer</li> </ol> </nav> </div> </div> <!-- Edit Form Card --> <div class="card"> <div class="card-header"> <h6 class="mb-0">Edit Offer</h6> </div> <div class="card-body"> <form action="offer_update.php" method="POST"> <input type="hidden" name="offer_id" value="<?= $offer['id'] ?>"> <div class="row"> <!-- Offer Heading --> <div class="mb-3 col-sm-6"> <label class="form-label">Offer Heading <span class="text-danger">*</span></label> <input type="text" class="form-control" name="offer_heading" value="<?= htmlspecialchars($offer['offer_heading']) ?>" required> </div> <!-- Button Text --> <div class="mb-3 col-sm-6"> <label class="form-label">Button Text <span class="text-danger">*</span></label> <input type="text" class="form-control" name="button_text" value="<?= htmlspecialchars($offer['button_text']) ?>" required> </div> <!-- Link --> <div class="mb-3 col-sm-6"> <label class="form-label">Redirect Link <span class="text-danger">*</span></label> <input type="text" class="form-control" name="link" value="<?= htmlspecialchars($offer['link']) ?>" required> </div> <!-- Status --> <div class="mb-3 col-sm-6"> <label class="form-label">Status</label> <select class="form-control" name="status" required> <option value="Active" <?= ($offer['status'] == 'Active') ? 'selected' : '' ?>>Active</option> <option value="Inactive" <?= ($offer['status'] == 'Inactive') ? 'selected' : '' ?>>Inactive</option> </select> </div> <!-- Buttons --> <div class="col-12 mt-4"> <button type="submit" class="btn btn-success">Update Offer</button> <a href="offer.php" class="btn btn-warning">Back to List</a> </div> </div> </form> </div> </div> </div> </div> <?php include "footer.php"; ?>