How can I avoid Form Select first entry being blank?, Form Select first entry is blank |
How can I avoid Form Select first entry being blank?, Form Select first entry is blank |
Hopworks |
Sep 20 2010, 06:13 PM
Post
#1
|
Group: Members Posts: 2 Joined: 20-September 10 Member No.: 12,766 |
I'm not very good with the terminology and I apologize in advance for that. I'm fairly new at what I am doing and I apologize for that too.
For the most part, I've had some wonderful success mixing PHP, HTML, and Javascripting to get what I want to work. Now I'm just nit picking. I'll be brief... I have a page that has a form select populated with data from a database. I click an entry in that listbox-looking thing and javascript shows a php file in a div where I edit text fields and even update the database with changes. All works great but I can't seem to figure out how to eliminate the blank first entry in my form's select control. I'm sure it is something simple, but I have googled it for hours with no resolution. I just want the list to be populated without a blank entry at the top. I can't figure out why it is there but again, I'm sure it is something I overlooked. Here is a sample of what I am doing, without setup, so don't look at the code as something working on it's own. CODE <form name="vendor_select" > <select name="users" size="35" value="1" onChange="showDBdata(this.value)"> <option value=""></option> <? for($x=0;$x<$result_count;$x++){ $row=mysql_fetch_row($result); ?> <option value="<? echo $row[0] ?>"><? echo $row[0] ?></option> <? } ?> </select> </form> Any advice pointing me to further reading or possible solutions would be greatly appreciated. Thank you! Hop |
Darin McGrew |
Sep 20 2010, 07:06 PM
Post
#2
|
WDG Member Group: Root Admin Posts: 8,365 Joined: 4-August 06 From: Mountain View, CA Member No.: 3 |
QUOTE <option value=""></option> You mean this blank first entry? |
Hopworks |
Sep 21 2010, 02:32 AM
Post
#3
|
Group: Members Posts: 2 Joined: 20-September 10 Member No.: 12,766 |
|
Lo-Fi Version | Time is now: 26th April 2024 - 10:36 PM |