-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheckout.php
75 lines (71 loc) · 3.33 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
<?php
include 'admin/db_connect.php';
// var_dump($_SESSION);
$chk = $conn->query("SELECT * FROM cart where user_id = {$_SESSION['login_user_id']} ")->num_rows;
if($chk <= 0){
echo "<script>alert('You don\'t have an Item in your cart yet.'); location.replace('./')</script>";
}
?>
<header class="masthead">
<div class="container h-100">
<div class="row h-100 align-items-center justify-content-center text-center">
<div class="col-lg-10 align-self-center mb-4 page-title">
<h1 class="text-white">Checkout</h1>
<hr class="divider my-4 bg-dark" />
</div>
</div>
</div>
</header>
<div class="container">
<div class="card">
<div class="card-body">
<form action="" id="checkout-frm">
<h4>Confirm Delivery Information</h4>
<div class="form-group">
<label for="" class="control-label">Firstname</label>
<input type="text" name="first_name" required="" class="form-control" value="<?php echo $_SESSION['login_first_name'] ?>">
</div>
<div class="form-group">
<label for="" class="control-label">Email</label>
<input type="text" name="last_name" required="" class="form-control" value="<?php echo $_SESSION['login_last_name'] ?>">
</div>
<div class="form-group">
<label for="" class="control-label">Contact</label>
<input type="text" name="mobile" required="" class="form-control" value="<?php echo $_SESSION['login_mobile'] ?>">
</div>
<div class="form-group">
<label for="" class="control-label">Address</label>
<textarea cols="30" rows="3" name="address" required="" class="form-control"><?php echo $_SESSION['login_address'] ?></textarea>
</div>
<div class="form-group">
<label for="" class="control-label">Email</label>
<input type="email" name="email" required="" class="form-control" value="<?php echo $_SESSION['login_email'] ?>">
</div>
<div class="text-center">
<button class="btn btn-block btn-outline-dark">Place Order</button>
</div>
</form>
</div>
</div>
</div>
<script>
$(document).ready(function(){
$('#checkout-frm').submit(function(e){
e.preventDefault()
start_load()
$.ajax({
url:"admin/ajax.php?action=save_order",
method:'POST',
data:$(this).serialize(),
success:function(resp){
if(resp==1){
alert_toast("Order successfully Placed.")
setTimeout(function(){
location.replace('index.php?page=home')
},1500)
}
}
})
})
})
</script>