-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathorder.html
More file actions
99 lines (94 loc) · 3.27 KB
/
order.html
File metadata and controls
99 lines (94 loc) · 3.27 KB
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
89
90
91
92
93
94
95
96
97
98
99
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<title>20141767</title>
<link rel="stylesheet" type="text/css" href="include/style.css">
<link href="https://fonts.googleapis.com/css?family=Jua" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Nova+Square" rel="stylesheet">
</head>
<body>
<!----------------------------------------------Header-->
<header>
<script src="include/header.js"></script>
</header>
<!------------------------------------------------Main-->
<section>
<form action="orderEnd.html" method="post">
<?php
session_cache_limiter("private_no_expire");
include $_SERVER["DOCUMENT_ROOT"]."/include/header.php";
include $_SERVER["DOCUMENT_ROOT"]."/include/connectDB.php";
$conn = db_connect();
$userNum = $_SESSION['userNum'];
echo '<a href="books.html">[뒤로가기]</a><br><br>';
$query = "SELECT * FROM credit WHERE user_number = '$userNum'";
$query2 = "SELECT * FROM user_has_address WHERE user_number = '$userNum'";
$result = mysqli_query($conn, $query);
$result2 = mysqli_query($conn, $query2);
$total_rows = mysqli_num_rows($result);
$total_rows2 = mysqli_num_rows($result2);
?>
<select name="credit">
<?php
while($row = mysqli_fetch_array($result)){
$card[] = $row['number'];
}
echo '<option value="">카드선택</option>';
for($index = 0; $index < $total_rows; $index++){
echo "<option value='$card[$index]'>$card[$index]</option>";
}
?>
</select>
<select name="address_index">
<?php
while($row2 = mysqli_fetch_array($result2)){
$address[] = $row2['address_detail'];
}
echo '<option value="">배송지선택</option>';
for($index = 0; $index < $total_rows2; $index++){
echo "<option value='$index'>$address[$index]</option>";
}
?>
</select>
<input type="submit" value="주문하기">
<?php
$title = [];
$price = [];
$book_number = [];
$count = $_POST['count_list'];
$query = "SELECT * FROM book";
$result = mysqli_query($conn, $query);
while($row = mysqli_fetch_array($result)){
$title[] = $row['title'];
$price[] = $row['price'];
$number[] = $row['number'];
}
echo '<br><br>========== 주문할 책 목록 ==========<br>';
for($index = 0; $index < count($price); $index++){
if($count[$index] > 0){
echo '책제목 : '.$title[$index].' / ';
echo '가격 : '.$price[$index].' / ';
echo '수량 : '.$count[$index].' / ';
$total = $price[$index] * $count[$index];
$all_total += $total;
echo '합계 : '.$total;
echo "<br>";
echo '<input type="hidden" name="book_number[]" value="'.$number[$index].'">';
echo '<input type="hidden" name="book_count[]" value="'.$count[$index].'">';
echo '<input type="hidden" name="book_total[]" value="'.$total.'">';
}
}
echo '총합계 : '.$all_total;
if($all_total == 0) echo "<script>if(!alert('고른 책이 없습니다.')) document.location = '/books.html'</script>";
mysqli_close($conn);
?>
</form>
</section>
<!----------------------------------------------Footer-->
<footer>
<script src="include/footer.js"></script>
</footer>
<!--------------------------------------------20141767-->
</body>
</html>