When I remove the name="prod_info" from the option tag in the first document, I this error: Warning: Undefined array key "prod_info" in C:\xampp\htdocs\ordersummary.php on line 51, which I know is because there is not anything that is defined as prod_info. However, when I add the name="prod_info" line back in to the option tag in the first document, I get this error: Parse error: syntax error, unexpected identifier "prod_info", expecting "," or ";" in C:\xampp\htdocs\products.php on line 64. I've tried using separate echo statements to solve the problem of expecting the , or ; symbols, but I get the same error. I've also tried placing the name="prod_info line in the option tag outside of the php section, but I still just get the Warning: Undefined array key "prod_info" in C:\xampp\htdocs\ordersummary.php on line 51 error. I'm confused as to how to get the second page to recognize where to pull the data from without using the POST technique. Thank you in advance for any help you are able to provide! The code for the two pages mentioned is listed below:
//The page the info is to be pulled from:
<!DOCTYPE html>
<html>
<head>
<title>Home</title>
<link href="novusreset.css" rel="stylesheet" />
<link href="novusstyles1.css" rel="stylesheet" />
<link href="novusstyles2.css" rel="stylesheet" />
<link href="novusflex.css" rel="stylesheet" />
<link href="novusnavicon.css" rel="stylesheet" />
<link href="novustables.css" rel="stylesheet" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
<header>
<a href="index.html"><img src="novuslogo.png" alt="Novus LLC." /></a>
<nav class="horizontal">
<a id="navicon" href="#"><img src="novusnavicon.png" alt="" /></a>
<ul id="navigation">
<li><a href="index.html" class="first">Home</a></li>
<li><a href="products.php">Products </a>
<ul id="productlist">
<li><a href="products.php">PC Parts</a></li>
<li><a href="products.php">Peripherals</a></li>
<li><a href="products.php">Networking</a></li>
<li><a href="products.php">Drinks</a></li>
<li><a href="products.php">Apparel</a></li>
</ul>
<li><a href="about.html">About</a></li>
<li><a href="support.html">Support</a></li>
<li><a href="account.html">Account</a></li>
<li><a href="cart.html">Cart</a></li>
</ul>
</nav>
</header>
<section id="main">
<article id="overview">
<form action="ordersummary.php" method="post">
<label for="products"><h1>Choose a product</h1></label>
<select name="products" id="products">
<option name="orderinfo">
<?php
include('connection.php');
$query = "SELECT * FROM products";
$result = mysqli_query( $conn, $query );
if(mysqli_num_rows($result) > 0) {
while( $row = mysqli_fetch_assoc($result) ){
echo "<option name="prod_info">" . $row["prod_name"] . " $" . $row["prod_price"] . "</option>";
}
} else{
echo "Ahhh yes, the big empty.";
}
mysqli_close( $conn );
?>
</br>
</br>
</option>
</select>
<label class="container">Gift Wrapping
<input type="checkbox">
<span class="checkmark"></span>
</label>
</br>
<label class="container">Gift Tagging
<input type="checkbox">
<span class="checkmark"></span>
</label>
</br>
</br>
<input type="submit" value="Place Order">
</form>
</article>
</section>
<footer>
©2021-Novus LLC. • 201 Main St. • Galena Il
</footer>
</body>
</html>
//The page that displays the info pulled from the above page in table form for the customer.
<!DOCTYPE html>
<html>
<head>
<title>Home</title>
<link href="novusreset.css" rel="stylesheet" />
<link href="novusstyles1.css" rel="stylesheet" />
<link href="novusstyles2.css" rel="stylesheet" />
<link href="novusflex.css" rel="stylesheet" />
<link href="novusnavicon.css" rel="stylesheet" />
<link href="novustables.css" rel="stylesheet" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
<header>
<a href="index.html"><img src="novuslogo.png" alt="Novus LLC." /></a>
<nav class="horizontal">
<a id="navicon" href="#"><img src="novusnavicon.png" alt="" /></a>
<ul id="navigation">
<li><a href="index.html" class="first">Home</a></li>
<li><a href="products.php">Products </a>
<ul id="productlist">
<li><a href="products.php">PC Parts</a></li>
<li><a href="products.php">Peripherals</a></li>
<li><a href="products.php">Networking</a></li>
<li><a href="products.php">Drinks</a></li>
<li><a href="products.php">Apparel</a></li>
</ul>
<li><a href="about.html">About</a></li>
<li><a href="support.html">Support</a></li>
<li><a href="account.html">Account</a></li>
<li><a href="cart.html">Cart</a></li>
</ul>
</nav>
</header>
<section id="main">
<article id="overview">
<h1>Order Summary</h1></br>
<table id="customers">
<?php
$prod_info = $_POST['prod_info'];
?>
<tr>
<th>Order Details:</th>
</tr>
<tr>
<td><?php echo prod_info;?></br></td>
</tr>
</table>
</article>
</section>
<footer>
©2021-Novus LLC. • 201 Main St. • Galena Il
</footer>
</body>
</html>