/Users/johnr/Desktop/IA pdf Downloads/_New Projects Downloads May 7th/CS_IA_Mattew/hotelandgolfselection.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 if(!apcu_fetch('destination') || !apcu_fetch('inquiry')){ 6 echo '<script>alert("An error occured, please try again.")</script>'; 7 ?><script>window.location.replace("http://localhost/golfasian")</script><?php 8 } 9 10 $destination = apcu_fetch('destination'); 11 $inquiry = apcu_fetch('inquiry'); 12 $datas = new GetMySQLData(); 13 14 error_reporting(E_ALL); 15 ini_set('display_errors', '1'); 16 17 ?> 18 19 <!DOCTYPE html> 20 <head> 21 <link href="style.css" rel="stylesheet"> 22 </head> 23 <script type="text/javascript"> 24 //function in order to display the other options if the user inputs a golf course 25 function setVisible(golfCourse, teeTime, teeTimeLabel, caddie, cart){ 26 var golfCourse = document.getElementById(golfCourse); 27 var teeTime = document.getElementById(teeTime); 28 var teeTimeLabel = document.getElementById(teeTimeLabel); 29 var caddie = document.getElementById(caddie); 30 var cart = document.getElementById(cart); 31 if(golfCourse.value != "") 32 { 33 teeTimeLabel.style.display = ''; 34 teeTime.style.display = ''; 35 caddie.style.display = ''; 36 cart.style.display = ''; 37 teeTime.setAttribute('required', ''); 38 }else{ 39 teeTimeLabel.style.display = 'none'; 40 teeTime.style.display = 'none'; 41 caddie.style.display = 'none'; 42 cart.style.display = 'none'; 43 teeTime.removeAttribute('required'); 44 } 45 } 46 </script> 47 <h1> Golf and Hotel Daily Planner </h1> 48 <div class="container"> 49 <form action="storeHotelAndGolfSelection.html" method="POST"> 50 <body> 51 <table> 52 <tr> 53 <th>Destination(s)</th> 54 <th>Arrival</th> 55 <th>Departure</th> 56 <th>Period</th> 57 <th>Hotel Standard</th> 58 </tr> 59 <tr> 60 <td> <?php echo $destination->getChosenDestination(); ?> </td> 61 <td> <?php echo $inquiry->getArrivalDate(); ?> </td> 62 <td> <?php echo $inquiry->getDepartureDate(); ?> </td> 63 <td> <?php echo $inquiry->getNumberOfDays(); ?> days, <?php echo $inquiry->getNumberOfNights() ?> nights</td> 64 <td> <?php echo $inquiry->getHotelRating()." stars"; ?> </td> 65 </tr> 66 </table> 67 <?php 68 for($i = 0; $i < $inquiry->getNumberOfDays(); $i++){ ?> 69 <p> 70 <fieldset class="dailyplan"> 71 <legend id="daynumber">Day <?php echo $i + 1; ?> </legend> 72 <?php 73 if($i == 0){ 74 echo "Note: Arrival Day <br><br>"; 75 }elseif($i == $inquiry->getNumberOfDays() - 1){ 76 echo "Note: Departure Day <br><br>"; 77 } ?> 78 <label for="golfcourse">Golfcourse: </label> 79 <select id="<?php echo "golfcourse".($i+1); ?>" name="<?php echo "golfcourse".($i+1); ?>" onchange="setVisible(this.id,'<?php echo "teetime".($i+1); ?>', '<?php echo "labelforteetime".($i+1); ?>', '<?php echo "labelforcaddie".($i+1); ?>', '<?php echo "labelforcart".($i+1); ?>')"> 80 <option value="">No golf day</option> 81 <?php foreach(explode(", ",$destination->getChosenDestination()) as $city){ 82 $golfCourses = $datas->getGolfCourseData($city); 83 echo '<optgroup label="'.$city.'">'; 84 foreach($golfCourses as $golfCourse){ ?> 85 <option value="<?php echo $golfCourse["GolfCourseName"]; ?>"> <?php echo $golfCourse["GolfCourseName"]; ?></option> 86 <?php 87 } ?> </optgroup> 88 <?php } ?> 89 </select><br> 90 <label class="checkbox-inline" for="<?php echo "caddie".($i+1); ?>" id="<?php echo "labelforcaddie".($i+1); ?>" style="display: none;"> 91 <input type="checkbox" value="1" name="<?php echo "caddie".($i+1); ?>" id="<?php echo "caddie".($i+1); ?>">Caddie</label> 92 <label class="checkbox-inline" for="<?php echo "cart".($i+1); ?>" id= "<?php echo "labelforcart".($i+1); ?>" style="display: none;"> 93 <input type="checkbox" value="1" name="<?php echo "cart".($i+1); ?>" id="<?php echo "cart".($i+1); ?>">Cart</label> 94 <p> 95 <label id="<?php echo "labelforteetime".($i+1); ?>" for="<?php echo "teetime".($i+1); ?>" style="display: none;">Requested Tee Time:</label> 96 <input type="time" id="<?php echo "teetime".($i+1); ?>" name="<?php echo "teetime".($i+1); ?>" class="teetime" min="06:00" max="18:00" style="display: none;"> 97 </p> 98 99 <?php if($i != $inquiry->getNumberOfDays() - 1){ ?> 100 <p> 101 <label for="hotel">Hotel: </label> 102 <select id="hotel" name="<?php echo "hotel".($i+1); ?>" required> 103 <option value="">Select hotel</option> 104 <?php 105 foreach(explode(", ",$destination->getChosenDestination()) as $city){ 106 $hotels = $datas->getHotelData($city, $inquiry->getHotelRating()); 107 echo '<optgroup label="'.$city.'">'; 108 foreach($hotels as $hotel){ ?> 109 <option value="<?php echo $hotel["HotelName"]; ?>"> <?php echo $hotel["HotelName"]; ?></option> 110 <?php } 111 ?> </optgroup> 112 <?php } ?> 113 </select><br> 114 <label class="checkbox-inline" for="<?php echo "hotelbreakfast".($i+1); ?>"> 115 <input type="checkbox" value="1" name="<?php echo "hotelbreakfast".($i+1); ?>" id="<?php echo "hotelbreakfast".($i+1); ?>">Hotel Breakfast</label> 116 </p> 117 <?php } ?> 118 <label class="checkbox-inline" for="<?php echo "transportation".($i+1); ?>">Transportation required 119 <input type="checkbox" value="1" name="<?php echo "transportation".($i+1); ?>"" id="<?php echo "transportation".($i+1); ?>"></label> 120 </fieldset> 121 </p> 122 <?php } ?> 123 <input type="submit" name="submit" value="Next Page"> 124 <input type="button" value="Back" onclick="history.back()"> 125 </div> 126 </form> 127 </div> 128 </html> 129 130