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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:03:39+00:00 2026-06-01T08:03:39+00:00

I have a web site that contains an HTML form, in this form I

  • 0

I have a web site that contains an HTML form, in this form I have a dropdownlist with list of agents that works in the company, I want to fetch data from MySQL database to this dropdownlist so when you add a new agent his name will appear as an option in the drop down list.

<select name="agent" id="agent">
</select>  
  • 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-01T08:03:40+00:00Added an answer on June 1, 2026 at 8:03 am

    To do this you want to loop through each row of your query results and use this info for each of your drop down’s options. You should be able to adjust the code below fairly easily to meet your needs.

    // Assume $db is a PDO object
    $query = $db->query("YOUR QUERY HERE"); // Run your query
    
    echo '<select name="DROP DOWN NAME">'; // Open your drop down box
    
    // Loop through the query results, outputing the options one by one
    while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
       echo '<option value="'.htmlspecialchars($row['something']).'">'.htmlspecialchars($row['something']).'</option>';
    }
    
    echo '</select>';// Close your drop down box
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this asp.NET web site that for some odd reason doesn't want to
I have a site a few years old that contains about 30 aspx Web
I have an ASP.NET web site which contains some ImageButton controls that cause postbacks
I have a page on a website that contains a secure form inside an
I have a web site that is a customer to customer (C2C) service. Example,
I have a web site that I administer that uses Apache 2.0 on the
I have a web site that spits out links to third party sites. Now
I have a web site that runs both classic ASP and ASP.NET Webforms. The
I have a web site that work with external Credit Card Processing (cybersource) when
I have a web service site that is restful enabled, so other websites/ajax script

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.