The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Help With Dropdown in Template/PHP
I'm working on a 3.5 modification (first time ever) of a sports "pick 'em" contest that is similar to vBPool. I had created it for 3.0, but the upgrade to 3.5 killed it. Football season is coming up and I'm trying hard to get it up and running again for this year. My problem is as follows:
I need the dropdown box (setup in the template) to go read a table in my database called vBContests and display all the results it finds (loop until fails). vBContests is one column (column name is contestname). I then just want them to select the result that they want. It doesn't have to do anything when they select it other than display it in the box. My question, and I'm no coder, so forgive me if it's dumb...but can somebody help me with the javascript text in the template and the related php code for the php file (the query)? I've tried to look at other hacks and can't find anything similar. The quick style chooser may be doing what I want -- but I haven't been able to figure out how that works. If anybody can help, I'd be greatly appreciative. UPDATE Okay, I've got it semi-working...but it's just displaying the first table and not looping to all of them. I know my code is wrong -- since it's bits and pieces from different places...so, can somebody offer advice? My PHP code: Code:
$activecontestquery = $db->query_read(" SELECT * FROM vBContests "); if (!$db->num_rows($activecontestquery)) { $contesterr = '<div align="center"><em>There are no contests!</em></div>'; } else {while ($contest = $db->fetch_array($activecontestquery)) { $user = $contest['contestname']; For the template, I have this (and I think this is what needs to be changed: Code:
<tr><td class="alt2" align="center" colspan="8">Select an active contest<script type="text/javascript"> <!-- function go1(){ if (document.selecter1.select1.options[document.selecter1.select1.selectedIndex].value != "none") { location = document.selecter1.select1.options[document.selecter1.select1.selectedIndex].value } } //--> </script> <script type="text/javascript"> <!-- document.write('<form name="selecter1"><select name="select1" size=1>'); document.write('<option value=none>--------------------'); document.write('<option value="$activecontestquery">$user'); // end hiding contents --> </script> </td></tr> Again, I know the code is probably not efficient and way wrong, but it's semi-working. I'm learning as I go, but could sure use some help now. Thanks! |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|