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 8981933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:27:30+00:00 2026-06-15T20:27:30+00:00

Possible Duplicate: Populate a Drop down box from a mySQL table in PHP I’m

  • 0

Possible Duplicate:
Populate a Drop down box from a mySQL table in PHP

I’m new to PHP/mySQL, but I’m learning it. I’m just creating a simple script to learn about mySQL, retrieving data from the database etc. I’m stuck on something, I hope you guys can help me!

I want to show the data of table ‘leerlingen’ in a html form, in the ‘select’ html tag. Each value has to has its own option tag, so like this:

  <select>
    <option value="VALUE 1">VALUE 1</option>
    <option value="VALUE 2">VALUE 2</option>
    <option value="VALUE 3">VALUE 3</option>
    <option value="VALUE 4">VALUE 4</option>
  </select>

I’ve searched a lot at Google, tried many things, but nothing seems to work..

Thanks!

Jelle

  • 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-15T20:27:31+00:00Added an answer on June 15, 2026 at 8:27 pm

    It would appear you need to write a foreach loop to parse through each database row you have from your query. Example below (result as an multidimensional array):

    <select>
    <?php
        foreach($rowset as $row) {
            echo '<option value="'.$row['id'].'">'.$row['value'].'</option>';
        }
    ?>
    </select>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: JavaScript - populate drop down list with array I have following select
Possible Duplicate: outputting values from database into html table PHP I am trying to
Possible Duplicate: Populate unique values in to VBA array from excel I need to
I want to copy an existing MySQL table over to a duplicate table, but
Possible Duplicate: How to properly escape a string via PHP and mysql I'm trying
Possible Duplicate: How can i retrieve a table from stored procedure to a datatable
Possible Duplicate: Update a Select Box on Parent Page from FancyBox2 I'm trying to
Possible Duplicate: Inserting new table row after the first table row using JQuery I
Possible Duplicate: Insert data from to a table From the main Tax table, I
Possible Duplicate: Unable to Populate TableView In PopOverController - Objective C I am using

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.