PHP shopping cart


#1

Hello I am trying to build a shopping cart for a sandwich shop for a university project. I have categories that appear on the first page and when i click on sandwichprices it brings up the name, image and description of 10 sandwiches. when i click on one sandwich i want an image of just that sandwich to appear on a seperate page with an in detail description. I have spent many hours but cannot find the solution.( i have called it sandwichprice when i should have just called it sandwich). The first php script is show_Sandwichprices.php. This has a function display_sandwichprice_details which is located in another script called output_functions. Can anyone help me

show_Sandwichprices.php

<?php include ('test_functions.php'); // The shopping cart needs sessions, so start one session_start(); $SandwichPricesID = $_GET['SandwichPricesID']; // get this sandwichprice out of database $sandwichprice = get_sandwichprice_details($SandwichPricesID); do_html_header($sandwichprice['title']); display_sandwichprice_details($sandwichprice); // set url for "continue button" $target = 'index1.php'; if($sandwichprice['category_id']) { $target = 'show_category.php?category_id='.$sandwichprice['category_id']; } output_functions: function display_sandwichprice_details($sandwichprice) { // display all details about this sandwich if (is_array($sandwichprice)) { echo ''; //display the picture if there is one if (@file_exists('images/'.($sandwichprice['SandwichPricesID']).'.jpg')) { $size = GetImageSize('images/'.$sandwichprice['SandwichPricesID'].'.jpg'); if($size[0]>0 && $size[1]>0) echo ''; } echo '
    '; echo '
  • Name: '; echo $sandwichprice['Name']; echo '
  • SandwichPriceID: '; echo $sandwichprice['SandwichPriceID']; echo '
  • Our Price: '; echo number_format($sandwichprice['price'], 2); echo '
  • Description: '; echo $sandwichprice['Description']; echo '
'; } else echo 'The details of this sandwich cannot be displayed at this time'; echo '
'; }