I wonder if you guys could help me. I have a table called modules and within it it has moduleID, moduleTitle, moduleCode etc.
A checkbox is populated next to each module that is displayed and the value of the checkbox is the moduleID. When a user checks the modules and click submit they get passed onto another page. On this other page I have managed to retrieve the moduleID’s which have been checked but I am having trouble in turning these moduleID so that I can display the moduleTitle, moduleCode etc for the ones that have been checked on this new page.
I have used the following code but no luck :confused:
<?php
$cats_upload = "";
foreach($_POST['module'] as $cats) // errors if no modules are selected
{
echo '<p>Module data moduleID: '.$cats.'</p>';
}
$sql = mysql_query("SELECT * FROM modules WHERE moduleID ='".$cats."'");
$productCount = mysql_num_rows($sql); //count the output amount
if($productCount > 0){
while($row = mysql_fetch_array($sql)){
$moduleTitle = $row["moduleTitle"];
$cats_upload .= "<tr><td>$moduleTitle</td></tr>";
}
} else {
$cats_upload = "<tr><td>No modules have been selected</td></tr>";
}
?>
If anyone has any suggestions to what it might be, please let me know.
Thanks
1 Answer