<li><a href="index.php">Home</a></li> <li><a href="movies.php">Movies</a></li> <li><a href="booking.php">Booking</a></li> <li><a href="contact-us.php">Contact Us</a></li> </ul> </nav> <div class="content-full-height"> <div class="container-main"> <h2> Complete Reservation</h2> <form class="contact-form" action="print.php" method="POST" name="contact-form"> <fieldset> <br/> <label>Price: $<?php echo htmlentities(calculateCart()); ?> .00</h3> <label>First Name: </label> <input type="text" name="fname" id="fname" required oninvalid="this.setCustomValidity('Please Enter Your First Name')"/> <label>Surname: </label> <input type="text" name="sname" id="sname" required oninvalid="this.setCustomValidity('Please Enter Your Surname')"/> <label>Email</label> <input type="email" name="email" placeholder="Enter Your Email Address" required oninvalid="this.setCustomValidity('Please Enter a valid email address')"> <label>Phone Number: </label> <input type="text" name="Phone_number" id="Phone_number" required oninvalid="this.setCustomValidity('Please Enter Your Phone Number')"/> <input type="submit" name="submit"> </fieldset> </form> </div>
echo "<tr><th>Ticket Type</th><th>Price</th><th>Quantity</th><th colspan='2'>Manage Cart</th>"; foreach ($shopping_cart as $product_id => $product_qty) { $product_details = array(); $product_details = getDetails($product_id); echo "<tr>"; echo "<td>" . htmlentities($product_details['product_name']) . "</td>"; printf("<td>\$%d.00</td>", $product_details['product_price']); echo "<form id='cart_form' method='post' action=" . $_SERVER['PHP_SELF'] . ">"; echo "<input type='hidden' name='product_id' value='" . htmlentities($product_id) . "'/ >"; echo "<td><input type='text' name='qty' value='" . htmlentities($product_qty) . "'/></td>"; echo "<td><input type='submit' value='Update Cart' name='update'/></td>"; echo "<td><input type='submit' value='Remove Item' name='delete'/></td>"; echo "</form>"; echo "</tr>"; } printf("<tr><td colspan='6' class='cart_total_row'>Total: \$%s.00</td></tr>", htmlentities(calculateCart())); echo "</table>"; } ?> </div> <form method='post' action='checkout.php'><button>Checkout</button></form> </div> </div> <?php require 'fragments/footer.php'; ?> </body>
/** * Функция которая возвращает массив информации * о просматриваемой страничка с типом $type * и $id * @param null $type * @param null $id * @return array */ function getContent($type = null, $id = null) { /*Если параметры null, то выводим страничку по умолчанию*/ if ($type == null) { $type = DEFAULT_PAGE; } if (isset($_POST['new_submit']) && $_POST['new_submit']) { $type = NEW_SUBMIT_TYPE; } $loginStatus = LOGIN_ALREADY; if (isset($_GET['unlogin']) && $_GET['unlogin']) { unlogin(); $loginStatus = LOGIN_EXIT; } if ($_POST['submit']) { $loginStatus = login($_POST['login'], $_POST['password']); } /*Инициализируем информацию в зависимости от типа */ $array = array(); switch ($type) { /*Если тип страницы - текстовая*/ case TEXT_TYPE: /*Если id не инициализирован выводим главную. Иначе страницу с id*/ if ($id == null) { $id = MAIN_PAGE_TEXT_ID; } /*Получаем текст из базы*/ $page = getTextContent($id); $array['content'] = $page['text']; break; case CATALOG_TYPE: /*Если id не инициаизирован */ if (!($id > 0)) { /*Выбираем первый попавшийся театр*/ $sql = "SELECT id from theatures LIMIT 1"; $res = mysql_query($sql); $row = mysql_fetch_array($res); $id = $row['id']; } /*Получаем спектали из базы*/ $items = getCatalogItems($id); //$parent_item = get; /*Вставляем их в ш для красивого вывода*/ $array['content'] = (include 'templates/content/item/items.php'); break; case ITEM_TYPE: $item = getItem($id); $array['content'] = (include 'templates/content/item/item_big.php'); break; case NEW_REG_TYPE: $array['content'] = (include 'templates/content/login/newreg.php'); break; case NEW_SUBMIT_TYPE: //Если пароли совпадают if ($_POST['new_password1'] == $_POST['new_password2']) { if (addNewUser($_POST['new_login'], $_POST['new_password2'])) { $array['content'] = 'Поздравляем вы зарегистерированы'; } else { $array['content'] = 'Такой пользователь уже есть'; } } else { $array['content'] = 'Пароли не совпадают'; } break; case ADD_CART_TYPE: addToCart($id); $cartItems = getCartItems(); $sum = calculateCart(); $array['content'] = (include 'templates/content/cart/cart.php'); break; case CART_TYPE: $cartItems = getCartItems(); $sum = calculateCart(); $array['content'] = (include 'templates/content/cart/cart.php'); break; /*Удаляем одну штуку*/ /*Удаляем одну штуку*/ case REMOVE_CART_TYPE: $cartItems = getCartItems(); $sum = calculateCart(); removeFromCart($id); $array['content'] = (include 'templates/content/cart/cart.php'); break; /*Удаляем весь товар*/ /*Удаляем весь товар*/ case REMOVE_ITEM_CART_TYPE: $cartItems = getCartItems(); $sum = calculateCart(); removeFromCart($id, CART_REMOVE_ALL); $array['content'] = (include 'templates/content/cart/cart.php'); break; case CLEAR_CART_TYPE: $cartItems = getCartItems(); $sum = calculateCart(); clearCart(); $array['content'] = (include 'templates/content/cart/cart.php'); break; } $user = getCurrentUser(); $array['theatures'] = getCatalogCategories(); $items = getCatalogCategories(); $array['leftPanel'] = (include 'templates/content/catalog/catalogCategories.php'); $array['rightPanel'] = (include 'templates/content/login/login.php'); $array['banner_word'] = 'Театры'; $array['title'] = 'Сайт'; return $array; }
echo "<p>Email: " . htmlentities($_POST['email']) . "</p>"; echo "<p>Phone Number: " . htmlentities($_POST['Phone_number']) . "</p>"; echo "<h3>Cart Contents</h3>"; echo "<div class='container-flex'>"; echo "<div class='print-ticket'>"; echo "<h3>" . htmlentities($_SESSION['movie']) . "</h3>"; echo "<h4>Day: " . htmlentities($_SESSION['day']) . " Time: " . htmlentities($_SESSION['time']) . "</h4>"; echo "<table>"; echo "<th>Ticket Type</th><th>Quantity</th>"; foreach ($cart as $product_id => $product_qty) { $product_details = array(); $product_details = getDetails($product_id); echo "<tr><td>" . htmlentities($product_details['product_name']) . "</td><td>" . htmlentities($product_qty) . "</td></tr>"; } echo "<br/>"; echo "<tr class='checkout_total_row'><td colspan='2'>Total: \$" . htmlentities(calculateCart()) . ".00</td></tr>"; echo "</table>"; echo "</div>"; unset($_SESSION['cart']); ?> </div> </div> </div> <?php