simple html drop down question
Posted: Wed Mar 08, 2006 1:01 pm
I have a drop down menu that is dynamically poplated from a database - that all works fine.
My problem is that I cannot get a title to appear in the drop down box which would say something along the lines of 'Make a selection...'
What I have managed is:
-to get one of the values to be displayed by default - but i dont want any of the values visible before the menu is opened.
-I have inserted a label into the list - however this is only visible once the drop down is opened - this is not good enough
-Declare 'Make a sellection...' as an option and set the 'selected' parameter - this would be perfect if there was a way to stop user selecting it and therefore submitting it.
Is there a way of stopping the user from selecting an option in this way and therefore preventing them from submitting it?
Can any one help me with this?
Thanks in advance.
i'll post the code i'm using
My problem is that I cannot get a title to appear in the drop down box which would say something along the lines of 'Make a selection...'
What I have managed is:
-to get one of the values to be displayed by default - but i dont want any of the values visible before the menu is opened.
-I have inserted a label into the list - however this is only visible once the drop down is opened - this is not good enough
-Declare 'Make a sellection...' as an option and set the 'selected' parameter - this would be perfect if there was a way to stop user selecting it and therefore submitting it.
Is there a way of stopping the user from selecting an option in this way and therefore preventing them from submitting it?
Can any one help me with this?
Thanks in advance.
i'll post the code i'm using
Code: Select all
$related_tags = '<select name="related_tags" >Choose a tag';
while($saved_tags = mysql_fetch_array($sql_saved_tags, MYSQL_ASSOC)){
$sql_get_tag_name = mysql_query("SELECT tag FROM f_tags WHERE tag_id = $saved_tags[tag_id]");
while($get_tag_name = mysql_fetch_array($sql_get_tag_name, MYSQL_ASSOC)){
$related_tags .= '<option value="">' . $get_tag_name['tag'] . '</option>';
}
}
$related_tags .= '</select>';