-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheckout.php
88 lines (87 loc) · 3.91 KB
/
checkout.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
include 'database.php';
$pid = $_GET['pid'];
$car = "SELECT * FROM cardata WHERE cardata.pid = :id ";
$carstmt = $dbcon->prepare($car);
$carstmt->bindParam(':id', $pid, PDO::PARAM_INT);
$carstmt->execute();
$rs_car = $carstmt->fetchAll()[0];
?>
<!DOCTYPE html>
<html>
<head>
<title>Vending Cars - Car Buying Made Simple</title>
<link rel="stylesheet" href="index.css">
</head>
<body onload="setupCheckout()">
<div class="banner">
<h1>Vending Cars</h1>
<div class="slogan">
The lowest priced cars anywhere
</div>
</div>
<div class="checkout">
<br/>
<h2 id="product">ORDER FOR: <?=$rs_car['make']?> <?=$rs_car['model']?> <?=$rs_car['trim']?></h2>
<div style="text-align: center;">
<form id="checkoutForm" action="send.php" method="POST">
<input type="hidden" id="carname" name="model">
<strong>Name:</strong> First:
<input type="text" name="firstname" value="" size=15>
Last:
<input type="text" name="lastname" id="lastname" value="" size=15>
<br/>
<strong>Phone:</strong> Intl. Code:
<input type="text" name="code" id="code" value="+" size=3 maxlength="7" oninput="conformIntlCode(this.value)" onkeypress="return isDigit(event, 'Phone Number')">
Number:
<input type="text" name="phone" id="phone" value="" size=10 oninput="conformPhoneNumber(this.value)" onkeypress="return isDigit(event, 'Phone Number')">
<br/>
<strong>E-mail Address:</strong>
<input type="text" name="email" id="email" value="" size=20>
<br/>
<strong>Shipping Method:</strong>
<select name="method" id="method" onchange="enableAddress()">
<option value="standard" selected="selected">Standard (7 days)</option>
<option value="fast">Fast (4 days)</option>
<option value="pickup">Pickup</option>
</select>
<br/>
<strong>Shipping Address:</strong>
<br/>
Street Address:
<input type="text" name="address" id="address" value="" size=30>
<br/>
Postal Code:
<input type="text" name="zip" id="zip" value="" size=6>
<br/>
Country:
<input type="text" name="country" id="country" value="" size=20>
<br/>
City:
<input type="text" name="city" id="city" value="" size=10>
State/Province:
<input type="text" name="state" id="state" value="" size=6>
<br/>
<strong>Payment Info:</strong> Card Number:
<input type="text" name="card" id="card" value="" size=16 onkeypress="return isDigit(event, 'Payment Info')">
CVV:
<input type="text" name="cvv" id="cvv" value="" size=2 onkeypress="return isDigit(event, 'Payment Info')">
<br/><br/>
<strong>TOTAL COST:</strong> <bdi id="totalCost">NULL</bdi>
<br/><br/>
<button onclick="document.getElementById('carname').value = productToString()">PURCHASE</button>
</form>
</div>
</div>
<div style="text-align:center">
<form action="index.php">
<input type="submit" value="Go back to index" />
</form>
</div>
<script type="text/javascript">var make="<?=$rs_car['make']?>"; var model="<?=$rs_car['model']?>"; var trim="<?=$rs_car['trim']?>"; var price=<?=$rs_car['price']?>;</script>
<script type="text/javascript" src="checkout.js"></script>
</body>
</html>
<?php
$carstmt->closeCursor();
?>