Sending a drop down list value using GET

Posted on 2007-10-09
Last Modified: 2013-12-13
Hi - You'll have to bear with me because I really am probably the most inexperienced person in doing this...

I'm populating a drop down list on a form using an SQL query.  When the user clicks 'go' I want to send the selected option over to the next page using GET.  The problem I'm encoutering is that the page loads but no value is sent.  I can add it manually to the URL and it works but it's not appearing automatically.

The code is as follows:

echo "<center>Marshals Found</center><br>";
echo "<form name='pickteam' id='pickteam' action='view_marshals.php' method='GET'>Pick team to view Marshals: <select name='team' value=''>";
// printing the list box select command

while($nt=mysql_fetch_array($result)){//Array or records stored in $nt
echo "<option value=$nt[id]>$nt[team]</option>";
/* Option values are added by looping through the array */
echo "</select> <INPUT TYPE='submit' VALUE='Go!'>";// Closing of list box

Question by:llantwit
    LVL 11

    Expert Comment

    Everything looks right, your submit button is within the form right?
    LVL 11

    Expert Comment


     name='team' value=''>

    change that too

    LVL 11

    Accepted Solution

    putting the value attribute on a select box is not needed, and it probably forces the browser to send blank no matter what is selected.
    LVL 28

    Expert Comment

    try removing the empty value in the select tag

    <select name='team' value=''> change for

    <select name='team'>

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
    SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
    In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
    This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now