The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> How can I avoid Form Select first entry being blank?, Form Select first entry is blank
Hopworks
post 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
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Darin McGrew
post 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?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Hopworks
post Sep 21 2010, 02:32 AM
Post #3





Group: Members
Posts: 2
Joined: 20-September 10
Member No.: 12,766



QUOTE(Darin McGrew @ Sep 20 2010, 05:06 PM) *

QUOTE
<option value=""></option>
You mean this blank first entry?

Yep that's it. I must have looked at that a 100 times. Stupid me. Thank you for pointing it out. unsure.gif
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 26th April 2024 - 10:36 PM