-
Notifications
You must be signed in to change notification settings - Fork 0
/
thanksOrder.php
43 lines (43 loc) · 1.13 KB
/
thanksOrder.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
require_once "classes/ShoppingCart.php";
if (!isset($_SESSION)) {
session_start();
}
$title = "Thanks";
$pageHeading = "Order Confirmation";
$orderId = 0;
//check pay button was pressed and there is a cart in the session
if (isset($_POST["pay"]) && isset($_SESSION["cart"])) {
//get all the posted data
$address = $_POST["address"];
$phone = $_POST["phone"];
$creditcard = $_POST["creditcard"];
$csv = $_POST["csv"];
$email = $_POST["email"];
$expiry = $_POST["expiry"];
$firstName = $_POST["firstName"];
$lastName = $_POST["lastName"];
$nameOnCard = $_POST["nameOnCard"];
//retreive shopping cart from session
$cart = $_SESSION["cart"];
//save the shopping cart
$orderId = $cart->saveCart(
$address,
$phone,
$creditcard,
$csv,
$email,
$expiry,
$firstName,
$lastName,
$nameOnCard
);
//clear the session
session_destroy();
}
//start buffer
ob_start();
//display order confirmation
include "templates/shoppingCart/confirmation.html.php";
$output = ob_get_clean();
include "templates/shoppingCart/layout.html.php";