PHP Programming               Exercise: Menu Interface              Spring 2015


0. Create appendItem.html: a form with options action="appendItem.php", and 
   method="post", plus input components for id, name, price, and quantity, and
   a submit button.






1. Code appendItem.php to obtain posted form values for assigning to variables.





2. Add code to invoke fopen() for appending('a+') to a file named Item.csv and 
   assign the return value to a file pointer named $fp. Example input data:
   04505,Noodle Cutter,18.95,6
   12016,Garlic Press,13.95,9
   15303,Coffee Maker,16.95,6
   16344,Nut Cracker,69.00,4
   20625,Potato Stomper,2.95,8
   22760,Butter Melter,4.95,6
   23316,Cheese Press,209.00,1
   31102,Copper Kettle,69.00,3
   36103,Pepper Grinder,27.50,4
   69206,IceCream Maker,199.00,6

3. Assign the form input variables to an array, then invoke fputcsv($fp, 
   $itemArray) to append a new row of item data to item.csv.





4. Prepare and invoke a separate PHP script to open the file item.csv for 
   reading('r'). Use fgetcsv($fp), a function to input a line with array 
   components for id, name, price, and quantity. For each input set, output
   the values. Finally, close the file.






5. Prepare an html menu page with two address links: one to appendItem.html
   that is an input form for collecting item data; the other link to a script
   (e.g. printItems.php) to retrieve the data from item.csv. To simplify 
   linking for testing, place into the same folder files for appendItem.html,
   appendItem.php, item.csv, plus the html menu page, and the script to print
   item data.