0

I have a php code that forms a dropdown using a mysql table. I am using the dropdown to search and filter results in a page. The problem that I have is that it only shows the values from the table, I also need an option where I can leave the dropdown blank. For example the values be a,b,c,d but if I do not want any of these options I want the dropdown left blank. Any ideas on how to do this? Thanks in advance for the help.

Here is the php code:
[<td>Program:</td><td>
<?php echo "<select name=formdata[Program_val] default value='Null' >Program</option>";
// printing the list box select command

while($nt=mysql_fetch_array($result)){//Array or records stored in $nt

echo "<option value=''$nt[ProgramId]>$nt[Program]</option>";
}]

3
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by vaultdweller123
0
<select name=formdata[Program_val] default value='Null' >Program</option>

Should be this.

<select name='formdata[Program_val]'>
    <option value='Null' selected='selected'>Program</option>

Edited by ShawnCplus: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.