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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T20:39:33+00:00 2026-05-28T20:39:33+00:00

I have hard coded and added items to dropdownlist ie teamsize as 1,2,3 like

  • 0

I have hard coded and added items to dropdownlist ie teamsize as 1,2,3 like that.

When i load this dropdownlist for edit/update i get duplicate values like this

1

1

2

3

4… How do i eliminate this duplicate values?

please find the code below

         <select name="anesthesia" id="selectAnesthesiaVal" style="width:25%;" class="required safe" AppendDataBoundItems = "false">
          <option value="<?php echo isset($event)?$event->proc_anesthesia_type:"" ;?>"><?php echo isset($event)?$event->proc_anesthesia_type:"" ;?></option><option value="General">General</option>
          <option value="Mac">Mac</option>
          <option value="Spinal/Epidural">Spinal/Epidural</option>
          <option value="Regional">Regional</option>
          <option value="Local">Local</option>
          <option value="Other">Other</option>
        </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-05-28T20:39:35+00:00Added an answer on May 28, 2026 at 8:39 pm

    If you do not want to use jQuery for this then I would advise placing all of the possible values into an array and looping through them in PHP. Then if the value exists, only place it once.

    In addition, if you would like to use jQuery and the PHP is not possible in your circumstances then let me know and I will post up some jQuery.

    UPDATE

    This will do the trick. I have clearly laid out comments to explain what is going on step by step. Hope this helps.

    Please note that it would be much more efficient to do this in PHP

    // Set the present object
    var present = {};
    $('#selectAnesthesiaVal option').each(function(){
        // Get the text of the current option
        var text = $(this).text();
        // Test if the text is already present in the object
        if(present[text]){
            // If it is then remove it
            $(this).remove();
        }else{
            // Otherwise, place it in the object
            present[text] = true;
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have something like this hard-coded: private string[,] m_RolesForUser = new string[,] { {John,President,Chair},
I have a hard coded URL like so: https://bupacouk.bwa.local.internal.bupa.co.uk/cash-plan-quote/quoteAction.do?getBenefitLevelDetails=getBenefitLevelDetails&productPolicyId=7841#a1 When Javascript is enabled i
I have 4 hard coded divs. After the third div I would like to
I need to have a Win32 application load a hard coded AES-256 key, ideally
Say that I have a DrawingBrush that has three colors hard-coded, i.e. a border,
I have a hard-coded list, each list item of which has an ID. I
I have a C program which has always used hard coded define statements for
its a little bit hard to understand. in the header.php i have this code:
Ok, I have a hardcoded string I declare like this name = uPar Catégorie
My situation is this: I have an ASP.NET web application that I want to

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.