add.php - PHP Online
Form of PHP Sandbox
*** This page was generated with the meta tag "noindex, nofollow". This happened because you selected this option before saving or the system detected it as spam. This means that this page will never get into the search engines and the search bot will not crawl it. There is nothing to worry about, you can still share it with anyone.
Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php
in the places where the PHP script should be executed.
Result of php executing
Full code of add.php.php
- <html>
- <head>
- <meta http-equiv="Content-Type"
- content="text/html; charset=UTF-8">
- <title>Add List</title>
- <link rel="stylesheet" href=
- "https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
- <link rel="stylesheet" href="css/style.css">
- </head>
- <body>
- <div class="container mt-5">
- <h1>Add Grocery List</h1>
- <form action="add.php" method="POST">
- <div class="form-group">
- <label>Item name</label>
- <input type="text"
- class="form-control"
- placeholder="Item name"
- name="iname" />
- </div>
- <div class="form-group">
- <label>Item quantity</label>
- <input type="text"
- class="form-control"
- placeholder="Item quantity"
- name="iqty" />
- </div>
- <div class="form-group">
- <label>Item status</label>
- <select class="form-control"
- name="istatus">
- <option value="0">
- PENDING
- </option>
- <option value="1">
- BOUGHT
- </option>
- <option value="2">
- NOT AVAILABLE
- </option>
- </select>
- </div>
- <div class="form-group">
- <label>Date</label>
- <input type="date"
- class="form-control"
- placeholder="Date"
- name="idate">
- </div>
- <div class="form-group">
- <input type="submit"
- value="Add"
- class="btn btn-danger"
- name="btn">
- </div>
- </form>
- </div>
- <?php
- if(isset($_POST["btn"])) {
- include("connect.php");
- $item_name=$_POST['iname'];
- $item_qty=$_POST['iqty'];
- $item_status=$_POST['istatus'];
- $date=$_POST['idate'];
- $q="insert into grocerytb(Item_name,
- Item_Quantity,Item_status,Date)
- values('$item_name',$item_qty,
- '$item_status','$date')";
- mysqli_query($con,$q);
- header("location:index.php");
- }
- // if(!mysqli_query($con,$q))
- // {
- // echo "Value Not Inserted";
- // }
- // else
- // {
- // echo "Value Inserted";
- // }
- ?>
- </body>
- </html>
File Description
- add.php
- PHP Code
- 23 Sep-2022
- 2.61 Kb
You can Share it:
Latest PHP Pastes