Jump to content

help on dynamic pulldown menu


pixeltrace

Recommended Posts

guys,

kindly check
[a href=\"http://www.sinagtala.net/sinag3/submitfeedback.php\" target=\"_blank\"]http://www.sinagtala.net/sinag3/submitfeedback.php[/a]
i am having problems with fixing the pulldown menu in
the events title section. hope you could help me with it.

this is the script that i used for that section
==================
<?
include 'db_connect.php';

$uSql = "SELECT event_title FROM events ORDER by event_date DESC";
$uResult = mysql_query($uSql, $connection);
if(!$uResult){
echo 'no data found';
}
else{
while($uRow = mysql_fetch_row($uResult)){
?>
<select name="title" size="1" class="sorteventlist">
<option selected><?= $uRow[3]?></option>
<?
}
}
?>
</select>
==================
what's wrong with this?
thanks in advance!
Link to comment
https://forums.phpfreaks.com/topic/4225-help-on-dynamic-pulldown-menu/
Share on other sites

You are putting the select in the loop. It has to go outside your loop and just put in the info

[code]<select name="title" size="1" class="sorteventlist">
<?
$uSql = "SELECT event_title FROM events ORDER by event_date DESC";
$uResult = mysql_query($uSql, $connection);
if(!$uResult){
echo 'no data found';
} else {
while($uRow = mysql_fetch_array($uResult)){
?>
<option value="<?=$uRow['event_title']?>" selected><?= $uRow['event_title]?></option>
<?
}
}
?>
</select>[/code]

I forget weather you need the value or not so I added it.

Ray

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.