Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

Drop down box

Asked Modified Viewed 1,425 times
C
Chibanga
C
  • Junior Member, joined since
  • Contributed 17 posts on the community forums.
  • Started 7 threads in the forums
  • Started this discussions
asked
Junior Member

Hi, how do i put this on a drop down box

openside("Poker Sites");
$result = dbquery("SELECT * FROM ".$db_prefix."downloads ORDER BY download_title asc ");
if (dbrows($result) != 0) {
echo "<table width='100%' cellpadding='0' cellspacing='0'>";
while ($data = dbarray($result)) {
echo "<tr>
<td class='small'>
<img src='".THEME."images/bullet.gif'>\n";
echo"<a href='".BASEDIR."downloads.php?cat_id=".$data['download_cat']."&download_id=".$data['download_id']."' title='".$data['download_title']."' class='side'>".stripslashes($data['download_title'])."</a>\n";

echo"</td>
</tr>";

}
echo "</table>";
} else {
echo "<div style='text-align:center'>".$locale['004']."</div>\n";
}
closeside();
Chibanga attached the following file:
1111.jpg [No information available / 50 Downloads]
0 replies

1 post

G
GMUDuckman
G
  • Senior Member, joined since
  • Contributed 266 posts on the community forums.
  • Started 6 threads in the forums
answered
Senior Member

[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]openside("Poker Sites"wink;
$result = dbquery("SELECT * FROM ".$db_prefix."downloads ORDER BY download_title asc "wink;
if (dbrows($result) != 0) {
echo "<select id='downloads'>";
while ($data = dbarray($result)) {
echo "<option value='".$data['download_id']."'>".stripslashes($data['download_title'])."</option>\n";
}
echo "</select>";
} else {
echo "<div style='text-align:center'>".$locale['004']."</div>\n";
}
closeside();[/syntaxhighlighter]

of course you will have to write some script to make it go to the download on select...
something like this -
[syntaxhighlighter brush=javascript,first-line=1,highlight=0,collapse=false,html-script=false]
$('#downloads'wink.change(function(){
var optionSelectedValue = $('#downloads option:selected'wink.val();
window.location = 'downloads/'+optionSelectedValue;
});
[/syntaxhighlighter]

this script most def won't work out of the box... but it should give you a vague idea...
Edited by GMUDuckman on 26-11-2010 20:42,
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 1 post
  • Votes 0 votes
  • Topic users 2 members

2 participants

C
C
  • Junior Member, joined since
  • Contributed 17 posts on the community forums.
  • Started 7 threads in the forums
  • Started this discussions
G
G
  • Senior Member, joined since
  • Contributed 266 posts on the community forums.
  • Started 6 threads in the forums

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet