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

  • SEARCH
  • Home
  • 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 8847737
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:15:41+00:00 2026-06-14T12:15:41+00:00

I have a basic mysqli code below where it performs a query to select

  • 0

I have a basic mysqli code below where it performs a query to select CourseId and Course Name from database and display it in a drop down menu.

$sql = "SELECT CourseId, CourseName FROM Course ORDER BY CourseId"; 

    $sqlstmt=$mysqli->prepare($sql);

    $sqlstmt->execute(); 

    $sqlstmt->bind_result($dbCourseId, $dbCourseName);

    $courses = array(); // easier if you don't use generic names for data 

    $courseHTML = "";  
    $courseHTML .= '<select name="courses" id="coursesDrop" onchange="getModules();">'.PHP_EOL; 
    $courseHTML .= '<option value="">Please Select</option>'.PHP_EOL;  

    while($sqlstmt->fetch()) 
    { 
    $course = $dbCourseId;
    $coursename = $dbCourseName; 
    $courseHTML .= "<option value='".$course."'>" . $course . " - " . $coursename . "</option>".PHP_EOL;  

    $outputcourse = ""; 
    $outputcourse .= "<p><strong>Course:</strong> " . $course .  " - "  . $coursename . "</p>";

    } 

    $courseHTML .= '</select>'; 

Now lets say the drop down menu contains these courses below:

INFO101 - Information Communication Technology
INFO102 - Computing

For some strange reason no matter which course I choose, it always echos the CourseId and CourseName INFO102 - Computing underneath the drop down menu. Why is this?

  • 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-06-14T12:15:42+00:00Added an answer on June 14, 2026 at 12:15 pm

    <p><strong>Course:</strong>.....</p> This may be causing the problem,

    because I don’t think its valid to have tags other than <option></option> inside a <select></select> tag.

    Try removing those stuff and see if the output appears in drop down.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a basic mysqli code below where it performs a query to select
I have this php code that grabs binary( blob ) data from the database
I was using the following code to retrieve HTML snippets from a database table
I have a basic CMS where a user can update a database of articles
I have a subselect query (like the one below) in my hibernate mapping XML
I have a problem posting data in my database with a form. Very basic
I have a database which contains the following : pnid partnumber desc code ====
Below I have 3 php scripts going in order from when user logs in,
Hi I have this basic mysql code: sql = 'INSERT INTO popularity (PersonNumber, Category,
I have basic question about mysqli prepared statements. For example, I want to execute

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.