I don't know how to edit my original post, but in case it matters, here are the two scripts.
SCRIPT 1
<!doctype html public "-//W3C//DTD HTML 4.0 //EN"> <html> <head> <title>BB's Title Selection</title> </head> <body bgcolor="lavender"> <font size=+1 face="nyala"> <h1>Welcome to BB's Inventory</h1> <?php //FILE : name_BB1.php //PROG : (My name) //PURP : This program takes data from name_form6.html and analyzes the corresponding database // for information to display to the user for further input, which will then be sent to name_BB2.php. //DEFINE VARIABLES $username = "root"; $password = "######"; $hostname = "localhost"; $id = array(); $count = 0; //EXTRACT DATA extract ($_POST); //CONNECT TO SERVER $link = mysqli_connect($hostname, $username, $password); if (!$link) { die('Not connected : ' . mysql_error()); } //ACTIVATE DATABASE $db_selected = mysqli_select_db($link, 'cpt283db'); if (!$db_selected) { die ('Can\'t use cpt283db : ' . mysql_error()); } //TEST CHOICE NOT EMPTY if (isset($choice)){ //DISPLAY DEPARTMENT echo "<h2>$choice department</h2>"; echo "For the department you have chosen we have listed below the available titles."; //SELECT PRODUCT $sql = "SELECT * from products WHERE department='$choice'"; //QUERY $result = mysqli_query($link, $sql) or die(mysql_error()); if (mysqli_num_rows($result) == 0){ echo "No results were found."; } //DISPLAY RESULTS echo "<table border='0' width=1200px> <tr> <th></th><th>ID</th><th>Entertainer/Author</th><th>Title</th><th>Media</th><th>Feature</th> </tr>"; //SEND DATA FOR SECOND QUERY echo "<form action='name_BB2.php' method='POST'>"; while($row = mysqli_fetch_assoc($result)){ $id[$count] = $row['ID']; echo "<tr>"; echo "<td> <input type='checkbox' name='ID[]' value='$id[$count]'/><br \> "; echo "<td align='center'>" . $row['ID'] . "</td>"; echo "<td align='center'>" . $row['entertainerauthor'] . "</td>"; echo "<td align='center'>" . $row['title'] . "</td>"; echo "<td align='center'>" . $row['media'] . "</td>"; echo "<td align='center'>" . $row['feature'] . "</td>"; echo "</tr>"; echo "<br>"; $count ++; } echo "</table>"; echo "<input type='submit' value='submit'>"; echo "</form>"; } else echo "You have not specified a department. Please press back on your browser to do so."; mysqli_close($link); ?> </font> </body> </html>
SCRIPT 2
<!doctype html public "-//W3C//DTD HTML 4.0 //EN"> <html> <head> <title>BB's Order Summary</title> </head> <body bgcolor="lavender"> <font size=+1 face="nyala"> <h1>Selection Summary</h1> <?php //FILE : name_BB2.php //PROG : (My name) //PURP : This program takes information from name_BB1.php and searches the corresponding databases // for information about the user's selection to display to the user. //DEFINE VARIABLES $username = "root"; $password = "######"; $hostname = "localhost"; extract ($_POST); $count = 0; echo "Thank you for your selections! Below, you will find a summary of your choices."; //CONNECT TO SERVER $link = mysqli_connect($hostname, $username, $password); if (!$link) { die('Not connected : ' . mysql_error()); } //ACTIVATE DATABASE $db_selected = mysqli_select_db($link, 'cpt283db'); if (!$db_selected) { die ('Can\'t use cpt283db : ' . mysql_error()); } //TEST IF CHOICE SELECTED if (isset($ID)){ $size = count($ID); //START TABLE echo "<table border='0' width=1200px><tr><th>ID</th><th>Entertainer/Author</th><th>Title</th> <th>Price</th><th>Units In Stock</th><th>Summary</th></tr>"; while ($count < $size){ //SELECT INVENTORY $sql = "SELECT * FROM prodinv LEFT JOIN products ON products.ID=prodinv.ID WHERE prodinv.ID=$ID[$count]"; //QUERY $result = mysqli_query($link, $sql) or die(mysql_error()); if (mysqli_num_rows($result) == 0){ echo "No results were found."; } //DISPLAY RESULTS while($row = mysqli_fetch_assoc($result)){ echo "<tr>"; echo "<td align='center'>" . $row['ID'] . "</td>"; echo "<td align='center'>" . $row['entertainerauthor'] . "</td>"; echo "<td align='center'>" . $row['title'] . "</td>"; echo "<td align='center'>" . $row['UnitPrice'] . "</td>"; echo "<td align='center'>" . $row['UnitsInStock'] . "</td>"; echo "<td align='center'>" . $row['summary'] . "</td>"; echo "</tr>"; echo "<br>"; } //REPEAT FOR EACH ID $count ++; }//END WHILE //END TABLE echo "</table>"; }//END IF else echo "You did not select any titles. If you wish to do so, please press the back button on your browser."; mysqli_close($link); ?> </font> </body> </html>
Script 2 is where I want to also send the $choice variable.
Thanks again. Please let me know if I'm posting this in the wrong place. Any advice is appreciated!