How do I populate a dropdown box from a xoops table?
Create a standard html form then add the following code:
<SELECT name="dropdown[]" size="10" multiple id="select">
<?php
$query = $xoopsDB->query(' SELECT * FROM ' . $xoopsDB->prefix('xoops_table'));
while ($row = $xoopsDB->fetchArray($query))
{
$sel = $row['field1'];
$id =$row['field2'];
echo "<OPTION VALUE='$id'>$sel</OPTION>n";
}
?>
</SELECT>
$count=count($dropdown);
for ($i=0; $i<$count; $i++) {
echo "result: ".$dropdown[$i]."<br>";
//do something else with each selected option.
}
<SELECT name="dropdown[]" size="10" multiple id="select">
<SELECT name="dropdown" size="10" id="select">
This Q&A was found on XOOPS Web Application System : https://xoops.org/modules/smartfaq/faq.php?faqid=514