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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:17:31+00:00 2026-06-16T00:17:31+00:00

Im making a selectbox with the values from my DB, and I want the

  • 0

Im making a selectbox with the values from my DB, and I want the first value to be “make a choice”.

How can it be done?
I have this code..

                <tr>
                <td width="180" height="30"><label for="valgtkon" class="labelLeft">Vælg konkurrencetype</label></td> 
                <td><select id="valgtTitel" name="valgtTitel" onchange="run()">                  
                <?php
                $virksomhedsID = $_SESSION['virkID'];
                $sql = "SELECT * FROM konkurrenceType ORDER BY konkurrenceType.kontypeID";
                $result = mysql_query($sql) or die(mysql_error());                  

                while($rowSelect = mysql_fetch_assoc($result))
                { 
                    $kontypeTitel = $rowSelect['kontypeTitel'];
                    $kontypeID = $rowSelect['kontypeID'];

                    echo '<option value="' . $kontypeID . '">' . $kontypeTitel . '</option>';
                }?>                    
                </select></td>
                <script>
                function run() {
                    document.getElementById("valgtID").value = document.getElementById("valgtTitel").value;
                }
                </script>


                <td><input type="text" name="valgtID" id="valgtID"/></td>
                </tr>
  • 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-16T00:17:32+00:00Added an answer on June 16, 2026 at 12:17 am

    Before the while loop, add another echo statement creating the option for the first “make a choice” option, then add some validation on submission to make sure they selected a different choice from the list.

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

Sidebar

Related Questions

Im making a selectbox with the values from my DB, and I want to
I have a code like this: var a = selectBox.options[selectBox.selectedIndex]; If I execute: alert(a);
Making my first steps in RIA Services (VS2010Beta2) and i encountered this problem: created
This is my thought... I'm making a selection from a database and one of
I don't have much experience with javascript so I' not sure if/how this can
I have an array in JavaScript that can go as deep as I want:
i'm making an Jlist in Netbeans and i have written a code but the
I'm sure I'm going to have to write supporting javascript code to do this.
I want to get values and attributes from a selector and then get attributes
I currently have a table in MySQL that stores values normally, but I want

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.