In productinfo.php copy the recently added delete link and paste it after itself.  Change one of them so that it points to editproduct.php instead of deleteproduct.php and change the text to the word Edit or an image.  Test the new link by hovering over it.

Save insertproducts.php as editproduct.php and:The edit links

  1. change the title and h1 heading
  2. convert the form to PHP:
    1. change the action to editproduct.php
    2. delete the onsubmit event trigger
    3. add readonly to the productID field
    4. go through the form escaping all double quotes
    5. delete the ?> just before the form and the <?php just after it
    6. add echo " just before the form opening tag and "; after the closing form tag so that the whole form is now one echo
  3. view the page and it should still look just like insertproducts.php (if not fix it)
  4. just before the form but inside the if:
    1. get the value from $_GET["product"] and put it into a variable
    2. use that variable to set up and run a SELECT query to get the four other pieces of data for that product and put them into four more variables
    3. in the form add value attributes to the five fields (remember to escape the quotes) and use the five variables as the values
    4. remove any placeholder attributes and values
  5. open productinfo.php in your browser, click on an edit link and you should see the form with data in all five fields
  6. back to editproduct.php:
    1. find the else and inside it change the INSERT query into an UPDATE query making sure you include the WHERE and LIMIT 1
    2. change the success message and remove the link to the add page

You should now be able to add, edit and delete products as well as seeing a list of products and individual product details.  Those functions are what almost everyone wants from an on-line database.