Create a new table called customerOrder in your database:

Open products.php in your editor.  Change the action of the form to processorder.php.

Create processorder.php from your template.  This page will receive the form data and store it in the database:

  1. replace the lines at the top of the code with the ones you used in viewlog.php but change the if condition to $type="customer"
  2. put a suitable title and main heading
  3. open insertproducts.php and copy all of the code inside the original else which puts form data into variables and INSERTs it into the database
  4. paste that into the PHP block in the middle of processorder.php
  5. change all of the variable names and indexes to suit the data coming in from the order form (you will need to add some more as this form has more fields)
  6. as you might remember checkboxes only send a value if they are ticked so those lines will not work properly:
    1. find the line which stores pickle in a variable and put a new line before it and another after it
    2. on the first new line put if(isset($_POST["pickle"])){
    3. change the original line by deleting the whole bit after = and rplacing that with 1; (if a value was sent we store a 1)
    4. on the second new blank line put } else { and then add another blank line after
    5. on the new blank line put $pickle=0;
    6. add one more blank line and close the curly brackets for the else
    7. do the same for the other three checkboxes
  7. change the INSERT query to insert the correct data into the correct table
  8. change the message at the end
  9. after that echo line close the curly bracket for the if which started right at the top and add an else which tells them they need to be logged in as a customer to order

Test the page.  If you get any errors or you did not really understand why you did some of that add a print_r() so that you can see the data which comes from the form depending on what was selected.