Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel="stylesheet" href="style.css">
- </head>
- <body>
- <form method = "post">
- <div class="container">
- ProdID
- <input type="text" name="pid">
- PName
- <input type="text" name="pname">
- descc
- <input type="text" name="descc">
- Price
- <input type="text" name="price">
- Qty
- <input type="text" name="qty">
- Category
- <input type="text" name="category">
- PImg
- <input type="text" name="pimg">
- <input type="submit" name="insert" value="Insert" class="registerbtn">
- </div>
- </form>
- </body>
- </html>
- <?php
- require "db.php";
- if(isset($_POST['insert']))
- {
- $pid = $_POST["pid"];
- $pname = $_POST["pname"];
- $pdesc = $_POST["descc"];
- $pprice = $_POST["price"];
- $pqty = $_POST["qty"];
- $pcat = $_POST["category"];
- $pimg = $_POST["pimg"];
- $stmt = $conn->prepare("INSERT INTO ProductDB(ProdID,PName,descc,Price,Qty,Category,PImg) VALUES (?,?,?,?,?,?,?)");
- $stmt-> bind_param("sssiiss",$pid,$pname,$pdesc,$pprice,$pqty,$pcat,$pimg);
- if($stmt->execute())
- {
- echo '<script language="javascript">';
- echo 'alert("Inserted Successfull")';
- echo '</script>';
- }
- else{
- echo "Failed To Connect". $conn ->error;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment