Advertisement
Guest User

Untitled

a guest
Jan 20th, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. <?php include "connect.php"; ?>
  2. <?php
  3. $id = $_GET['edit'];
  4. $result = mysqli_query($mysqli,"SELECT * FROM inventory_table WHERE id=$id");
  5. $user_data = mysqli_fetch_object($result);
  6. ?>
  7.  
  8. <form action="" method="POST">
  9. ITEM NAME : <input type="text" name="item_name" value="<?php echo $user_data->item_name; ?>"><br>
  10. QUANTITY : <input type="number" name="quantity" value="<?php echo $user_data->quantity; ?>"><br>
  11. PRICE : <input type="text" name="price" value="<?php echo $user_data->price; ?>"><br>
  12. <input type="submit" name="submit" value="SUBMIT">
  13. </form>
  14.  
  15. <?php
  16. if(isset($_POST['submit'])){
  17. $item_name = $_POST['item_name'];
  18. $quantity = $_POST['quantity'];
  19. $price = $_POST['price'];
  20.  
  21. $query = "UPDATE inventory_table SET item_name = '$item_name',
  22. quantity = '$quantity',
  23. price = '$price'
  24. WHERE id = '$id'";
  25. $update = mysqli_query($mysqli,$query);
  26.  
  27. if($update){ ?>
  28. <script>window.location = 'index.php';</script>
  29. <?php
  30. }
  31. }
  32. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement