Create a PAGE below:
<html>
<head>
<title>iPhone store</title>
</head>
<body>
<table border='1' cellpadding='5' cellspacing='0'>
<caption>iPhone store</caption>
<tr>
<th>id</th>
<th>model</th>
<th>price</th>
<th>quantity</th>
</tr>
<?php
$dsn = "mysql:dbname=XXXXX"; //Database Source Name
$username = "XXXXX";
$password = "YYYYYYYYY";
try{
$conn = new PDO($dsn, $username, $password);
//To throw exceptions whenever a database error occurs
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch(PDOException $e) {
echo "Connection failed: ". $e->getMessage();
}
$sql = "select * from iPhone";
$rows = $conn->query($sql);
foreach($rows as $row){
echo "<tr><td>".$row["id"]."</td>";
echo "<td>".$row["model"]."</td>";
echo "<td>".$row["price"]."</td>";
echo "<td>".$row["quantity"]."</td></tr>";
}
?>
</table>
<form action="shop.php" method="post">
<h2>Which iPhone are you going to buy?</h2>
<input type="radio" name="model" value="iPhone 12 Pro Max" style="margin-bottom: 10px;"/>
<label>iPhone 12 Pro Max</label><br />
<input type="radio" name="model" value="iPhone 12 Pro" style="margin-bottom: 10px;"/>
<label>iPhone 12 Pro</label><br />
<input type="radio" name="model" value="iPhone 12" style="margin-bottom: 10px;"/>
<label>iPhone 12</label><br />
<input type="radio" name="model" value="iPhone XR" style="margin-bottom: 10px;"/>
<label>iPhone XR</label><br />
<input type="radio" name="model" value="iPhone 11" style="margin-bottom: 10px;"/>
<label>iPhone 11</label><br />
<h2>How many iPhones are you going to buy?</h2>
<label>Number of iPhones to buy</label>
<input type="text" name ="num" size="12" style="margin-bottom: 10px;" /><br />
<input type ="submit" value = "submit the form" style="margin-bottom: 10px;" /><br />
<input type ="reset" value = "reset the form" style="margin-bottom: 10px;" />
</form>
<?php
$conn = null;
?>
</body>
</html>