Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Not selecting value from drop down list

Posted on 2008-11-10
6
Medium Priority
?
184 Views
Last Modified: 2013-12-13
I have created a drop down list that displays values from mysql database.  The values are displayed but when a value is selected it no value is present.  Using html form.  Here is the drop down code:

echo "<select name=location value=''>Location</option>";
// printing the list box select command

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


When I output Location in program that is called by form it is empty.
0
Comment
Question by:tpiccirillo
  • 2
4 Comments
 
LVL 16

Expert Comment

by:Robin
ID: 22928390
How does the html output look like?

Try surrounding the $nt[id] by (double) quotes.
0
 
LVL 15

Accepted Solution

by:
quincydude earned 1000 total points
ID: 22928438
If you have checked the generated source code and see no problem with the select and option (with correct option values) html code, the problem may be from your output program.
0
 

Author Comment

by:tpiccirillo
ID: 22931851
Out put program is working okay for other fields.  Just nothing in this field that is dynamically created.
0
 
LVL 16

Assisted Solution

by:Robin
Robin earned 1000 total points
ID: 22934654
Can you try to remove value part in the select tag and change it to:



echo "<select name=location>";
 
while($nt=mysql_fetch_array($result)){
  echo "<option value=$nt[id]>$nt[location]</option>";
}
echo "</select>";

Open in new window

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
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.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

572 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