Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php include "connect.php"; ?>
- <?php
- $id = $_GET['edit'];
- $result = mysqli_query($mysqli,"SELECT * FROM inventory_table WHERE id=$id");
- $user_data = mysqli_fetch_object($result);
- ?>
- <form action="" method="POST">
- ITEM NAME : <input type="text" name="item_name" value="<?php echo $user_data->item_name; ?>"><br>
- QUANTITY : <input type="number" name="quantity" value="<?php echo $user_data->quantity; ?>"><br>
- PRICE : <input type="text" name="price" value="<?php echo $user_data->price; ?>"><br>
- <input type="submit" name="submit" value="SUBMIT">
- </form>
- <?php
- if(isset($_POST['submit'])){
- $item_name = $_POST['item_name'];
- $quantity = $_POST['quantity'];
- $price = $_POST['price'];
- $query = "UPDATE inventory_table SET item_name = '$item_name',
- quantity = '$quantity',
- price = '$price'
- WHERE id = '$id'";
- $update = mysqli_query($mysqli,$query);
- if($update){ ?>
- <script>window.location = 'index.php';</script>
- <?php
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement