HEX
Server: Apache/2.4.46 (Ubuntu)
System: Linux localhost 5.11.0-49-generic #55-Ubuntu SMP Wed Jan 12 17:36:34 UTC 2022 x86_64
User: root (0)
PHP: 7.4.16
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/html/barcode/admin/edit-product.php
<?php session_start();
include_once('../includes/config.php');
if (strlen($_SESSION['adminid'] == 0)) {
    header('location:logout.php');
} else {
    //Code for Updation 
    if (isset($_POST['update'])) {
        $fname = $_POST['fname'];
        $lname = $_POST['lname'];
        $contact = $_POST['contact'];
        $userid = $_GET['uid'];
        $msg = mysqli_query($con, "update users set fname='$fname',lname='$lname',contactno='$contact' where id='$userid'");

        if ($msg) {
            echo "<script>alert('Profile updated successfully');</script>";
            echo "<script type='text/javascript'> document.location = 'manage-users.php'; </script>";
        }
    }



?>
    <!DOCTYPE html>
    <html lang="en">

    <head>
        <meta charset="utf-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
        <meta name="description" content="" />
        <meta name="author" content="" />
        <title>Edit Barcode | Barcode Management System</title>
        <link href="https://cdn.jsdelivr.net/npm/simple-datatables@latest/dist/style.css" rel="stylesheet" />
        <link href="../css/styles.css" rel="stylesheet" />
        <script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/js/all.min.js" crossorigin="anonymous"></script>
    </head>

    <body class="sb-nav-fixed">
        <?php include_once('includes/navbar.php'); ?>
        <div id="layoutSidenav">
            <?php include_once('includes/sidebar.php'); ?>
            <div id="layoutSidenav_content">
                <main>
                    <div class="container-fluid px-4">

                        <?php
                        $product_id = $_GET['pid'];
                        $query = mysqli_query($con, "select * from barcodes where id='$product_id'");
                        while ($result = mysqli_fetch_array($query)) { ?>
                            <h3 class="mt-4"><?php echo $result['product_name']; ?></h3>
                            <div class="card mb-4">
                                <form method="post">
                                    <div class="card-body">
                                        <table class="table table-bordered">
                                            <tr>
                                                <th>Product Name</th>
                                                <td><input class="form-control" id="product_name" name="product_name" type="text" value="<?php echo $result['product_name']; ?>" required /></td>
                                            </tr>
                                            <tr>
                                                <th>Product Code</th>
                                                <td><input class="form-control" id="product_code" name="product_code" type="text" value="<?php echo $result['product_code']; ?>" required /></td>
                                            </tr>
                                            <tr>
                                                <th>Thickness</th>
                                                <td colspan="3"><input class="form-control" id="thickness" name="thickness" type="text" value="<?php echo $result['thickness']; ?>" required /></td>
                                            </tr>
                                            <tr>
                                                <th>Size</th>
                                                <td colspan="3"><input class="form-control" type="text" name="size" id="size" value="<?php echo $result['size']; ?>"></td>
                                            </tr>


                                            <tr>
                                                <th>Batch No.</th>
                                                <td colspan="3"><input class="form-control" type="text" name="batch_no" id="batch_no" value="<?php echo $result['batch_no']; ?>"></td>
                                            </tr>
                                            <tr>
                                                <th>Slab No.</th>
                                                <td colspan="3"><input class="form-control" type="text" name="slab_no" id="slab_no" value="<?php echo $result['slab_no']; ?>"></td>
                                            </tr>
                                            <tr>
                                                <th>Book Matching</th>
                                                <td colspan="3"><input class="form-control" type="text" name="book_matching" id="book_matching" value="<?php echo $result['book_matching']; ?>"></td>
                                            </tr>
                                            <tr>
                                                <td colspan="4" style="text-align:center ;"><button type="submit" class="btn btn-primary btn-block" name="update">Update</button></td>

                                            </tr>
                                            </tbody>
                                        </table>
                                    </div>
                                </form>
                            </div>
                        <?php } ?>

                    </div>
                </main>
                <?php include('../includes/footer.php'); ?>
            </div>
        </div>
        <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous"></script>
        <script src="../js/scripts.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.min.js" crossorigin="anonymous"></script>
        <script src="https://cdn.jsdelivr.net/npm/simple-datatables@latest" crossorigin="anonymous"></script>
        <script src="../js/datatables-simple-demo.js"></script>
    </body>

    </html>
<?php } ?>