File "category-edit.php"
Full path: /home/fsibplc/public_html/fsib/firstcash/admin/category-edit.php
File
size: 4.98 B (4.98 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 Category<a href="category-view.php" class="btn btn-danger float-end">Back</a></h4>
</div>
<div class="card-body">
<?php
if(isset($_GET['id']))
{
// $category_id = $_GET['id'];
$string = preg_replace('/[^A-Za-z0-9\-]/','-',$_GET['id']);//remove all special characters
$final_string = preg_replace('/-+/', '-', $string);
$category_id = $final_string;
$category_edit = "SELECT * FROM categories WHERE id = '$category_id' LIMIT 1 ";
$category_run = mysqli_query($con, $category_edit);
if(mysqli_num_rows($category_run) >0 )
{
$row = mysqli_fetch_array($category_run);
?>
<form action="code.php" method="POST">
<input type="hidden" name="category_id" value="<?= $row['id']; ?>">
<div class="row">
<div class="col-md-6 md-3">
<label for="">Name</label>
<input type="text" name="name" value="<?= $row['name']; ?>" required class="form-control">
</div>
<div class="col-md-6 md-3">
<label for="">Slug (URL)</label>
<input type="text" name="slug" value="<?= $row['slug']; ?>" required class="form-control">
</div>
<div class="col-md-12 md-3">
<label for="">Description</label>
<textarea name="description" required class="form-control" rows="4"><?= $row['description']; ?></textarea>
</div>
<div class="col-md-12 md-3">
<label for="">Meta Title</label>
<input type="text" name="meta_title" value="<?= $row['meta_title']; ?>" max="191" required class="form-control">
</div>
<div class="col-md-6 md-3">
<label for="">Meta Description</label>
<textarea name="meta_description" required class="form-control" rows="4"><?= $row['meta_description']; ?></textarea>
</div>
<div class="col-md-6 md-3">
<label for="">Meta Keyword</label>
<textarea name="meta_keyword" required class="form-control" rows="4"><?= $row['meta_keyword']; ?></textarea>
</div>
<div class="col-md-6 md-3">
<label for="Status">Navbar Status</label>
<input type="checkbox" name="navbar_status" <?= $row['navbar_status'] == '1' ? 'checked': '' ?> width="70px" height="70px" />
Checked = Hidden In Menubar, Unchecked = Visible In Menubar
</div>
<div class="col-md-6 md-3">
<label for="Status">Status</label>
<input type="checkbox" name="status" <?= $row['status'] == '1' ? 'checked': '' ?> width="70px" height="70px" />
Checked = Hidden, Unchecked = Visible
</div>
<div class="col-md-6 md-3">
<button type="submit" class="btn btn-primary" name="category_update">Update Category</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');
?>