0

hello. I have a drop down menu that pulls from a mysql database. I know its connecting fine and there is actual items in the drop down menu because I echoed them.

However when I look at my drop down box, you cannot see the options! I know the items are there but its simply not visible. HOw can I alter my code so that its visible.

php:

$sql="SELECT title FROM Election";
$result= mysql_query($sql);
$options="";
while ($row=mysql_fetch_array($result)) {
  $title=$row["title"];
    $options.="<OPTION VALUE=\"$title\">";
     }

}

HTML:

<SELECT NAME="title" style="font-size:11pt; font-family: arial,helvetica,sans-serif; color:#080000">
<OPTION VALUE="0" style="font-size:11pt; font-family: arial,helvetica,sans-serif; color:#080000">View an election

<?=
$options
?>
</SELECT>
4
Contributors
6
Replies
7
Views
7 Years
Discussion Span
Last Post by venkat0904
2

hello. I have a drop down menu that pulls from a mysql database. I know its connecting fine and there is actual items in the drop down menu because I echoed them.

However when I look at my drop down box, you cannot see the options! I know the items are there but its simply not visible. HOw can I alter my code so that its visible.

php:

$sql="SELECT title FROM Election";
$result= mysql_query($sql);
$options="";
while ($row=mysql_fetch_array($result)) {
  $title=$row["title"];
    $options.="<OPTION VALUE=\"$title\">";
     }

}

HTML:

<SELECT NAME="title" style="font-size:11pt; font-family: arial,helvetica,sans-serif; color:#080000">
<OPTION VALUE="0" style="font-size:11pt; font-family: arial,helvetica,sans-serif; color:#080000">View an election

<?=
$options
?>
</SELECT>

try this:
php:

$sql="SELECT title FROM Election";
$result= mysql_query($sql);
$options="";
while ($row=mysql_fetch_array($result)) {
  $title=$row["title"];
    $options.="<OPTION VALUE=\"$title\">$title</OPTION>";
     }

}

HTML:

<SELECT NAME="title" style="font-size:11pt; font-family: arial,helvetica,sans-serif; color:#080000">
<OPTION VALUE="0" style="font-size:11pt; font-family: arial,helvetica,sans-serif; color:#080000">View an election

<?
echo $options;
?>
</SELECT>

hope it helps... cheers!!

0

I have just done something similar. The above looks good to me, but if it doesn't work then I'll post my code up too

:)

0

I have just done something similar. The above looks good to me, but if it doesn't work then I'll post my code up too

:)

Yeah i should have tested it b4 posting here.. :P
newayz its pretty simple n shud work..:idea:

0

hope it helps... cheers!!

OMG. thank you very much! It works! This helped a lot. something so minor like this was giving me a headache. lol thanks again!

1

OMG. thank you very much! It works! This helped a lot. something so minor like this was giving me a headache. lol thanks again!

well if ur problem is solved then i suggest u mark the thread as solved..
Glad i could help..
cheers!!

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.