This repository was archived by the owner on Sep 14, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsauce.php
More file actions
76 lines (56 loc) · 1.66 KB
/
Copy pathsauce.php
File metadata and controls
76 lines (56 loc) · 1.66 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
<?php
session_start();
$pizzaSelect=$_GET["pizza"];
?>
<!DOCTYPE html>
<html>
<head>
<title>Sauce and quantity</title>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>
<body background="background1.jpg">
<?php
$conn = mysqli_connect('localhost','root', '', 'pizzastore');
if ( !$conn ) {
die("Connection failed: " .mysqli_connect_error()); /* Establish connection with database */
}
$sql = "SELECT * FROM pizza";
$pizzaDetail = mysqli_query($conn, $sql)
or die('Problem with query' . mysqli_error()); /* Get the pizza info from database */
$sau = "SELECT * FROM sauce";
$sauDetail = mysqli_query($conn, $sau)
or die('Problem with query' . mysqli_error()); /* Get the sauce info from database */
?>
<h1>Please select the quantity of your pizza</h1>
<p style="text-align: center;">You chose:</p>
<form action="Cart.php" method="post">
<div style="text-align: center;">
<img src=<?php echo $pizzaSelect ?>>
<?php $_SESSION['pizzaSe']=$pizzaSelect ?>
<select name="valuePizza" >
<?php
$i=0;
while ($i<= 10) { /* Decide how many pizza can be ordered once */
?>
<option value=<?php echo $i ?>><?php echo $i ?></option>
<?php
$i++;
}
?>
</select>
</div>
<dev style="text-align: center;">
<?php
while ($row = mysqli_fetch_array($sauDetail, MYSQLI_ASSOC)) { /* Display pictures and set pizzaID as value, they were retrieved from database */
?>
<img src=<?php echo $row["SaucePic"] ?>>
<div style="text-align: center;">
<button value=<?php echo $row["SaucePic"] ?> name="sauce" >Add this sauce to Pizza</button>
</div>
<?php
}
?>
</dev>
</form>
</body>
</html>