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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T13:00:21+00:00 2026-05-15T13:00:21+00:00

I am having a list box like this ,the list box is populated from

  • 0

I am having a list box like this ,the list box is populated from the database

<td bgcolor="#FFFFCC">
<select name="listbox" id="FriendmailId" size="3" >
<option value="0">Select User From List</option>
<? foreach($searchfriend as $row)
{?>

<option value=""><?=$row['dEmailID'];?></option>
<? } ?>
</select>
</td>

The values are listed in the list box ….but the problem is when i select a item it is highted but not really selected why it is so

  • 1 1 Answer
  • 1 View
  • 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-15T13:00:22+00:00Added an answer on May 15, 2026 at 1:00 pm

    You need to add selected="selected" for the option value you want selected:

    <option value="" selected="selected"><?=$row['dEmailID'];?></option>
    

    In a loop, this is usually done when a certain condition is met for an option to be selected (of course only one option can be selected at a time)

    <? foreach($searchfriend as $row)
      if (condition to select a specific option value) // when true
      {
    {?>    
    <option value="" selected="selected"><?=$row['dEmailID'];?></option>
    <? } else {  ?>
    <option value=""><?=$row['dEmailID'];?></option>
    <? }} ?>
    

    Note: If you don’t specify selected="selected" for an option, by default, first option value is selected.

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

Sidebar

Related Questions

I am having a listbox in ASP.net. I am populating the listbox values from
I'm having a bit of trouble populating a listbox on a windows form from
I'm having an issue displaying an object in a checked list box in C#.
I have a ListBox which is populated from a collection of ViewModels, which uses
I feel like this should be simple but I'm having issues getting it to
I'm trying to design a recipe box database and I'm having trouble getting it
Hi all i am having a list box on my Form which will display
I've been having a problem with making sorted lists from dictionaries. I have this
i am having two list box which perform add remove item functionality which are
I have a ListBox control that I want to change into having a toggle

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.