MMCT TEAM
Server IP : 45.113.226.95  /  Your IP : 216.73.217.37
Web Server : LiteSpeed
System : Linux bharat.hostitbro.com 5.14.0-611.13.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 11 04:57:59 EST 2025 x86_64
User : digita21 ( 1701)
PHP Version : 8.3.30
Disable Function : mail
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF
Directory (0755) :  /home2/digita21/worldwideengineers.in/admin/gallery/../

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home2/digita21/worldwideengineers.in/admin/gallery/../category-update.php
<?php
include("header.php");
include("aside.php");

$id = $_GET['id'];
$select = "SELECT * FROM `category` WHERE `id` = '$id'";
$query = mysqli_query($connect, $select);

// Check if the category with the given ID exists and fetch the data
if ($query && mysqli_num_rows($query) > 0) {
    $row = mysqli_fetch_assoc($query);
} else {
    die("Category not found");
}

if (isset($_POST['submit'])) {
    $catname = $_POST['catname']; // Use 'catname' instead of 'category_name'

    // Make sure to use prepared statements to prevent SQL injection
    $update = "UPDATE `category` SET `category_name`='$catname' WHERE `id` = '$id'";
    $sql = mysqli_query($connect, $update);

    if ($sql) {
        echo "Data updated";
    } else {
        echo "Data did not update: " . mysqli_error($connect);
    }
}
?>

<div class="container w-100 h-100 mt-5">
    <button> <a class="btn btn-outline-primary" href="categoriestable.php">View Data</a></button>
    <h3 class="text-center">Categories</h3>
    <div class="row">
        <div class="col-md-6 mt-5">
            <form method="post">
                <div class="form-group">
                    <label for="catname">Categories Name:</label>
                    <input type="text" value="<?php echo $row['category_name']?>" class="form-control" name="catname" id="catname" placeholder="Categories Name">
                </div>
                
                <div class="form-check">
                    <input type="checkbox" class="form-check-input" id="exampleCheck1">
                    <label class="form-check-label" for="exampleCheck1">Check me out</label>
                </div>
                <button type="submit" class="btn btn-primary" name="submit">Submit</button>
            </form>
        </div>
    </div>
</div>

<?php include("footer.php"); ?>

MMCT - 2023