-
Notifications
You must be signed in to change notification settings - Fork 0
/
phpshopnow.php
132 lines (109 loc) · 3.46 KB
/
phpshopnow.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?php
$insert=false;
if(isset($_POST['card'])){
$server="localhost";
$username="root";
$password="";
$con=mysqli_connect($server,$username,$password);
if(!$con){
die("connect is failed due to ".mysqli_connect_error());
}
echo "success connecting to db";
$girlshirt=$_POST['girlshirt'];
$boyshirt=$_POST['boyshirt'];
$watch=$_POST['watch'];
$sql="INSERT INTO `cart2`.`cart2`(`girlshirt`,`boyshirt`,`watch`) VALUES ('$girlshirt','$boyshirt','$watch'); ";
echo $sql;
if($con->query($sql) == true){
echo"successfully inserted";
$insert=true;
}
else{
echo "alert('not inserted')";
echo"not added";
// echo "ERROR: $sql <br> $con->error";
}
$con->close();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet"href="styleshopnow.css">
</head>
<body>
<header>
<ul>
<li>HOME</li>
<li>FEATURE</li>
<li>CONTACT US</li>
<li>ABOUT US</li>
</ul>
</header>
<main>
<div class="bg">
<img class="backgroundpic"src="backgroundpic2.jpg">
</div>
<form action="phpshopnow.php" method="post">
<div class="mainitems">
<div class="item"><img src="gpro1.jpg"><h3>Espirit Ruffle Shirt</h3>
<p>$16.61</p>
<div class="addtocart">
<input type="radio"name="girlshirt"id="c1"value="girlshirt">Add to Cart</input>
</div>
<!-- <div class="cartcontainer">
<button class="btnincre"onclick="increment()">+</button><h2 class="count"id="counting"></h2><button class="btndecre" onclick="decrement()">-</button>
</div> -->
</div>
<!-- 2item -->
<div class="item"><img src="bpro1.jpg">
<h3>Espirit Ruffle Shirt</h3>
<p>$16.61</p>
<div class="addtocart">
<input type="radio"name="boyshirt"id="c2"value="boyshirt">Add to Cart</input>
</div>
</div>
<!-- 3rd item -->
<div class="item"><img src="apro1.jpg"><h3>Espirit Ruffle Shirt</h3>
<p >$16.61</p>
<div class="addtocart">
<input type="radio"name="watch"id="c3"value="watch">Add to Cart</input>
</div>
</div>
<!-- 2nd line -->
<div class="item"><img src="gpro1.jpg"><h3>Espirit Ruffle Shirt</h3>
<p>$16.61</p>
<div class="addtocart">
<input type="radio"name="girlshirt"id="c1"value="girlshirt">Add to Cart</input>
</div>
<!-- <div class="cartcontainer">
<button class="btnincre"onclick="increment()">+</button><h2 class="count"id="counting"></h2><button class="btndecre" onclick="decrement()">-</button>
</div> -->
</div>
<!-- 2item -->
<div class="item"><img src="bpro1.jpg">
<h3>Espirit Ruffle Shirt</h3>
<p>$16.61</p>
<div class="addtocart">
<input type="radio"name="boyshirt"id="c2"value="boyshirt">Add to Cart</input>
</div>
</div>
<!-- 3rd item -->
<div class="item"><img src="apro1.jpg"><h3>Espirit Ruffle Shirt</h3>
<p >$16.61</p>
<div class="addtocart">
<input type="radio"name="watch"id="c3"value="watch">Add to Cart</input>
</div>
</div>
</div>
<button name="card">MY CARD</button>
</form>
</main>
<script src="shopnow.js">
</script>
</body>
</html>