/Users/johnr/Desktop/IA pdf Downloads/_New Projects Downloads May 7th/CS_IA_Mattew/storeHotelAndGolfSelection.html |
1 <?php 2 spl_autoload_register(function ($class_name) { // https://www.php.net/manual/en/language.oop5.autoload.php 3 include $class_name . '.class.php'; 4 }); 5 $destination = apcu_fetch('destination'); 6 $inquiry = apcu_fetch('inquiry'); 7 $inquiry->setDestination($destination); 8 9 $numberOfDays = $inquiry->getNumberOfDays(); 10 $dayPlans = new SplFixedArray($numberOfDays); 11 12 for($i = 0; $i < $inquiry->getNumberOfDays(); $i++){ 13 if($_POST["golfcourse".($i+1)] != ""){ 14 $golfCourse = $_POST["golfcourse".($i+1)]; 15 if(isset($_POST["caddie".($i+1)])){ 16 $caddie = 1; 17 }else{ 18 $caddie = 0; 19 } 20 if(isset($_POST["cart".($i+1)])){ 21 $cart = 1; 22 }else{ 23 $cart = 0; 24 } 25 $teeTime = $_POST["teetime".($i+1)]; 26 27 }else{ 28 $golfCourse = "No golf day"; 29 $teeTime = NULL; 30 $caddie = NULL; 31 $cart = NULL; 32 } 33 if($i != $inquiry->getNumberOfDays()-1){ 34 $hotel = $_POST["hotel".($i+1)]; 35 } 36 if(isset($_POST["hotelbreakfast".($i+1)])){ 37 $hotelBreakfast = 1; 38 }else{ 39 $hotelBreakfast = 0; 40 } 41 if(isset($_POST["transportation".($i+1)])){ 42 $transportation = 1; 43 }else{ 44 $transportation = 0; 45 } 46 $dayPlan = new DayPlan($golfCourse, $teeTime, $caddie, $cart, $hotel, $hotelBreakfast, $transportation); 47 $dayPlans[$i] = $dayPlan; 48 } 49 $inquiry->setDayPlans($dayPlans); 50 apcu_store('dayplans', $dayPlans); 51 header("Location: submitpage.html"); 52 die(); 53 54