Hello, I have a bit of a problem. I am pretty new to PHP and have had a website thrust upon me to fix. I've been searching far and wide for a solution for my checkbox issue, however, most of the things I've found only explain how to display predefined values of said checkboxes.
Here's what I'm trying to do. I have a list of reports in my MySQL database that the users will be allowed to select from. I've assigned checkboxes to each report description with it's price. What I need now is when the user hit submit, the next page displays only the report descriptions and price checked in the list, along with a total price. I haven't got to the sum of price values yet, as I can't even get the items to display.
Here is the list page:
http://www.fantiniresearch.com/report_list.php
Here is my report list code:
echo "<center> Sorry! there were no Files that matched your search. </center>";
}
echo "<h2>Select the reports you would like to purchase</h2>";
echo "<br>";
echo "<form action='file_select.php' method='POST'>";
while ($row=mysql_fetch_array($sql_result)) {
$id = $row["id"];
$file_number=$row["file_number"];
$filename=$row["filename"];
$description=$row["description"];
$price=$row["price"];
$active=$row["active"];
echo "<table border=0>";
echo "<tr>";
echo "<td width=10px><input type='checkbox' name='item[]' value=$id</td>";
echo "<td width=300px>$description</td>";
echo "<td><b>$price</b></td>";
echo "</tr>";
echo "</table>";
}
echo "<br><input type='submit' class='button' value='Continue' tabindex='2'>";
//
echo "</form>";
Here is the file_select.php code:
Echo "<h2>Individual Reports</h2>";
$aReport = $_POST['item'];
if(empty($aReport))
{
echo("You didn't select any reports.");
}
else
{
$N = count($aReport);
echo("You selected $N report(s): ");
for($i=0; $i < $N; $i++)
{
echo($aReport[$i] . " ");
}
}
Any help would be highly appreciated.