Create a new page called insertproducts.php by saving a copy of products.php.  You need a form which will allow someone to add new products to the productinfo table:The add new product form

  1. change the title and main heading to Insert a new product or similar
  2. delete the paragraphs
  3. in the form you need three text inputs, a number input and a text area so delete most of the existing form fields leaving just one text area
  4. change the action to insertproducts.php
  5. remove the onsubmit event trigger
  6. change the attributes for the text area to make it suitable for entering the productDescription data
  7. add three text inputs and one number input with labels (for productID, productType, productName and productCalories)

The form should now look right but will not do anything if you submit.  Currently the page only shows the form so you need to add an if to see if the form has been posted and the code to process the new data:

  1. add a new PHP block just before the form
  2. in it put the start of the if statement (if(!$_POST){)
  3. after the end of the form put another PHP block
  4. inside that close the curly bracket of the if and put an else
  5. inside the else put the code to save the data (you might want to check that the page looks the same before doing this):
    1. extract the five items of data from $_POST and put them into variables remembering to use mysqli_real_escape_string()
    2. create an INSERT query and run it
    3. echo a success message and links to add another product and to the productinfo.php page

The page should now show the form and when it is filled in the new product should appear in the database table.  There are many improvements you could make to this page.  Make a note of any you think of and come back to it later.