Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6326031
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:00:24+00:00 2026-05-24T17:00:24+00:00

I wonder if you guys could help me. I have a table called modules

  • 0

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 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T17:00:25+00:00Added an answer on May 24, 2026 at 5:00 pm
    $cats_upload = "";
    
    if (!empty($_POST['module'])) {
    
        foreach ($_POST['module'] as $moduleID) {
          $modules[] = $moduleID;
        }
    
        $module_list = implode(',', $modules);
    
        $sql = "SELECT moduleTitle FROM modules WHERE moduleID IN (" . $module_list . ")";
        $result = mysql_query($sql) or die("Error in $sql: " . mysql_error());
    
        while ($row = mysql_fetch_array($result)) { 
            $cats_upload .= "<tr><td>" . $row['moduleTitle'] . "</td></tr>";
        }
    
    } else {
        $cats_upload .= "<tr><td>No modules have been selected</td></tr>";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi guys wonder if you guys could help me I'm trying to compile a
Hey, I wonder if you guys could help me with redirecting the following url:
Wonder how I could do the following wit jquery - I have a url
I have a simple php page which outputs a table (which has been created
Hello guys I have a router (Belkin) so I wonder how can I see
hey guys, i wonder how I could solve this in the best way: I
I wonder how you guys manage deployment of a database between 2 SQL Servers,
Hello there fellow Stackers! I wonder if anybody could tell me what the following
I wonder how TDD is done in Rails. Here are the steps I have
hey guys, i wonder how difficult it is (and what programming languages i need)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.