The following is a specific example from my roster system tied into my .Threads install.<br /><br />In this example I populate a drop down box for my members to choose from a list of possible classes avaiable on EverQuest.<br /><br />All this comes from a globals file I use so I can keep my templates cleaner and this code is used on multiple pages.<br /><br />----<br />
Query<br /><br />
$EQClass_query = mysql_query("SELECT EQClassID, EQClass<br /> FROM {$config['tbprefix']}eqclass ORDER BY EQClass"); <br /><br />
Code for drop down box <br /><br />
<br /><br />// Build the class select box<br />$selecteqclass_select = "<select name=\"EQClassID\" class=\"formboxes\">";<br /><br />while ($class = mysql_fetch_array($EQClass_query)){<br /> extract($class,EXTR_PREFIX_ALL,"v");<br /> { <br /> $selecteqclass_options .= "<option value=\"$v_EQClassID\">$v_EQClass</option>"; <br /> }<br />}<br /><br />$selecteqclass_end .= "</select>"; <br /><br />
How I implement it on the template file <br /><br />
Template code <br /><br />
<b>Class:</b><br />$selecteqclass_select<br />$selecteqclass_options<br />$selecteqclass_end<br /><br />
<br /><br />And finally, an example is attached as to how it displays.<br /><br />Hope that helps some. <img src="http://www.ubbdev.com/forum/images/graemlins/smile.gif" alt="" />