File "merchant-edit.php"
Full path: /home/fsibplc/public_html/localhost/admin/merchant-edit.php
File
size: 6.74 B (6.74 KB bytes)
MIME-type: text/x-php
Charset: utf-8
Download Open Edit Advanced Editor Back
<?php
include('config/dbcon.php');
include('authentication.php');
//session_start();
include('include/header.php');
?>
<div class="container-fluid px-4">
<div class="row mt-4">
<div class="col-md-12">
<?php include('message.php'); ?>
<div class="card">
<div class="card-header">
<h4>Edit Merchant<a href="merchant-view.php" class="btn btn-danger float-end">Back</a></h4>
</div>
<div class="card-body">
<?php
if (isset($_GET['id']) && filter_var($_GET['id'], FILTER_VALIDATE_INT)) {
$service_id = mysqli_real_escape_string($con, $_GET['id']);
// $service_id = $_GET['id'];
$stmt = $conn->prepare("SELECT * FROM merchant_card WHERE id= ? LIMIT 1");
$stmt->bind_param("i", $service_id);
$stmt->execute();
$result = $stmt->get_result();
$stmt->close();
if(mysqli_num_rows($result) > 0)
{
$service_row = mysqli_fetch_array($result);
?>
<form action="code.php" method="POST" enctype="multipart/form-data" id="post-form">
<input type="hidden" name="merchant_id" value="<?= $service_row['id'] ?>">
<div class="row">
<!-- <input type="hidden" name="slug" value="<?= $service_row['slug']; ?>" required class="form-control">-->
<div class="col-md-6 md-3">
<label for="">Merchant Name</label>
<input type="text" name="merchant_name" value="<?= $service_row['merchant_name']; ?>" required class="form-control">
</div>
<div class="col-md-6 md-3">
<label for="">Merchant List</label>
<?php
$merchant = "SELECT DISTINCT(merchant_category) FROM `merchant_card`";
$merchant_run = mysqli_query($con, $merchant);
if(mysqli_num_rows($merchant_run) > 0 )
{
?>
<select name="merchant_category" required class="form-control">
<option value="">--Select Merchant--</option>
<?php
foreach($merchant_run as $merchantitem)
{
?>
<option value="<?=$merchantitem['merchant_category']; ?>" <?= $merchantitem['merchant_category']==$service_row['merchant_category'] ? 'selected':''?> >
<?=$merchantitem['merchant_category']; ?>
</option>
<?php
}
?>
</select>
<?php
}else{
}
?>
</div>
<div class="col-md-6 md-3">
<label for="">Discount Text</label>
<input type="text" name="discount_text" value="<?= $service_row['discount_text']; ?>" required class="form-control">
</div>
<div class="col-md-6 md-3">
<label for="">Merchant Website Link</label>
<input type="text" name="merchant_link" value="<?= $service_row['merchant_link']; ?>" required class="form-control">
</div>
<div class="col-md-6 md-3">
<label for="">Logo Image</label>
<input type="hidden" name="old_image" value="<?= $service_row['image'] ?>">
<input type="file" name="image" class="form-control">
</div>
<div class="col-md-6 md-3">
<label for="Status">Expiry Date</label>
<input id="datepicker" width="276" value="<?= $service_row['expiry_date'] ?>" name="date" placeholder="dd-mm-yyyy">
</div>
<input type="hidden" name="author" value="<?= $_SESSION['auth_user']['user_name'];?>" >
<div class="col-md-6 md-3">
<label for="Status">Status</label>
<input type="checkbox" name="status" <?= $service_row['status'] == '1' ? 'checked':''?> width="70px" height="70px" />
</div>
<div class="col-md-6 md-3">
<button type="submit" class="btn btn-primary" name="merchant_update">Update Merchant</button>
</div>
</div>
</form>
<?php
}else{
?>
<h4>No Record Found.</h4>
<?php
}
}
?>
</div>
</div>
</div>
</div>
</div>
<?php
include('include/footer.php');
include('include/script.php');
?>