Update, Delete And Reserve Product In PHP
Submitted by rinvizle on Tuesday, November 15, 2016 - 15:36.
Update, Delete And Reserve Product In PHP, in this tutorial i will teach you how this application created in PHP. This simple tutorial updates the products and the quantity of every data of product. You can also Delete and Reserve a products that you want to reserve. Each product that you've been reserved has based on the day that you issued and the day that you want it to pick the product. Every reserved product has been recorded to the list of reserved users. Here are the sample script that i will show you.
And for the function of Updating the products.
For the Delete function of every product that you select. In this function the data has been disable the Update function so the user can't rename or edit the fields in each data products.
I hope that you learn in this tutorial and don't forget to Like and Share.
Enjoy Coding! :)
Sample Code
PHP Script For the Products List.- <!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Update, Delete & Reserve Products</title>
- </head>
- <body>
- <center><div id="header"><h1 class="header-text">Update, Delete & Reserve Products</h1><div id=menu-modal>
- <a href="index.php"><button id="b1" class="btn btn-primary "> Home</button></a>
- <a href="viewreserved.php"><button id="b2" class="btn btn-primary "> View Reserved Products</button></a>
- </div></div></center>
- <div id="container2">
- <div class="form_head" align="center">List Of Products</div><br>
- <div class="control-group">
- <table name="booklist" id="dtable" width="900">
- <thead>
- <th>Product ID</th>
- <th>Product Name</th>
- <th>Product Category</th>
- <th>Product Quantity</th>
- <th>Function</th>
- </thead>
- <tbody>
- <?php
- include "dbconnect.php";
- $q="select * from tblproducts order by prod_id asc";
- $prodid=$rs['prod_id'];
- $prodname=$rs['prod_name'];
- $categ=$rs['prod_ctry'];
- $qty=$rs['prod_qty'];
- echo "<tr class='tb1'>";
- echo "<td>".$prodid."</td>";
- echo "<td>".$prodname."</td>";
- echo "<td>".$categ."</td>";
- echo "<td>".$qty."</td>";
- echo "<td> <a href='edit.php?id=$prodid' id='popedit'>Update</a> | <a href='delete.php?id=$prodid' id='popedit'>Delete</a> | <a href='reserve.php?id=$prodid' id='popreserve'>Reserve</a> </td>";
- echo "</tr>";
- }
- ?>
- <tbody>
- </table>
- </div>
- </div>
- </body>
- </html>
- <?php
- include "dbconnect.php";
- $prod_id=$_GET['id'];
- $q = "select * from tblproducts where prod_id='$prod_id'";
- $prodid=$rs['prod_id'];
- $prodtitle=$rs['prod_name'];
- $prodctry=$rs['prod_ctry'];
- $prodqty=$rs['prod_qty'];
- }
- $fctgry="select * from category";
- ?>
- <center><div id="header"><h1 class="header-text">Update, Delete & Reserve Products</h1><div id=menu-modal>
- <a href="index.php"><button id="b1" class="btn btn-primary "> Home</button></a>
- <a href="viewreserved.php"><button id="b2" class="btn btn-primary "> View Reserved Products</button></a>
- </div></div></center>
- <div id="container">
- <div class="form_head" align="center">Update Products</div><br>
- <form method="post" action="process.php">
- <label class="control-label">Product ID :</label>
- <div class="controls">
- <input type="text" name="ebookid" placeholder="Product ID" id="ebookid" value="<?php echo $prodid;?>"/>
- </div>
- <label class="control-label">Product Name :</label>
- <div class="controls">
- <input type="text" name="ebookname" placeholder="Product Name" id="ebookname" value="<?php echo $prodtitle;?>"/>
- </div>
- <label class="control-label">Category :</label>
- <div class="controls">
- <select name="ecategory" id="ecategory">
- <option><?php echo $prodctry; ?></option>
- <?php
- $categ=$rs['category'];
- echo "<option>".$categ."</option>";
- }
- ?>
- </select>
- </div>
- <label class="control-label">Quantity :</label>
- <div class="controls">
- <input type="text" name="equantity" placeholder="Number of Products to add" id="equantity" value="<?php echo $prodqty; ?>"/>
- </div>
- <div class="controls">
- <button id="btn" class="btn btn-primary">Update</button>
- <a href="index.php" id="btnc" class="btn btn-info">Cancel</a>
- </div>
- </form>
- <?php
- include "dbconnect.php";
- $prod_id=$_GET['id'];
- $q = "select * from tblproducts where prod_id='$prod_id'";
- $prodid=$rs['prod_id'];
- $prodtitle=$rs['prod_name'];
- $prodctry=$rs['prod_ctry'];
- $prodqty=$rs['prod_qty'];
- }
- $fctgry="select * from category";
- ?>
- <center><div id="header"><h1 class="header-text">Update, Delete & Reserve Products</h1><div id=menu-modal>
- <a href="index.php"><button id="b1" class="btn btn-primary "> Home</button></a>
- <a href="viewreserved.php"><button id="b2" class="btn btn-primary "> View Reserved Products</button></a>
- </div></div></center>
- <div id="container">
- <div class="form_head" align="center">Delete Products</div><br>
- <form method="post" action="process.php?did=<?php echo $prodid; ?>">
- <label class="control-label">Product ID :</label>
- <div class="controls">
- <input type="text" name="dbookid" placeholder="Product ID" id="dbookid" value="<?php echo $prodid;?>" disabled/>
- </div>
- <label class="control-label">Product Name :</label>
- <div class="controls">
- <input type="text" name="dbookname" placeholder="Product Name" id="dbookname" value="<?php echo $prodtitle;?>" disabled/>
- </div>
- <label class="control-label">Category :</label>
- <div class="controls">
- <select name="dcategory" id="dcategory" disabled>
- <option><?php echo $prodctry; ?></option>
- <?php
- $categ=$rs['category'];
- echo "<option>".$categ."</option>";
- }
- ?>
- </select>
- </div>
- <label class="control-label">Quantity :</label>
- <div class="controls">
- <input type="text" name="dquantity" placeholder="Number of Products to add" id="dquantity" value="<?php echo $prodqty; ?>" disabled/>
- </div>
- <div class="controls">
- <button id="btn" class="btn btn-primary">Delete</button>
- <a href="index.php" id="btnc" class="btn btn-info">Cancel</a>
- </div>
- </form>
- </div>
Comments
Add new comment
- Add new comment
- 1883 views