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>
This will create a var called $dropdown which is an array. To read through the results you can use this:
$count=count($dropdown);
for ($i=0; $i<$count; $i++) {
echo "result: ".$dropdown[$i]."<br>";
//do something else with each selected option.
}
IN case you don't want the select box to be multiselect, replace this:
<SELECT name="dropdown[]" size="10" multiple id="select">
with this:
<SELECT name="dropdown" size="10" id="select">
Interesting
Can you elaborate a lil more on this feature? What I have in mind is setting up an automotive type form.
Example
First tab would be
Name:
Address:
City:
State:
Country:
Phone:
Second tab would be
Year:
2006
2005
2004
Make:
Chev
Dodge
Ford
Model:
Caprice
Impala
Nova
Parts Needed:
Ect. Ect.
Third tab would be Shipping instructions or something...
Have a look here at this center block design.
http://www.bahut.com/
I would like to set up a form system the same way. Would it be hard to pass the data all the way to the end of the tabs then submit the form.
I would love to pull the cats from an XOOPS table.
I hope this makes sence...