SmartFAQ is developed by The SmartFactory (https://www.smartfactory.ca), a division of InBox Solutions (https://www.inboxsolutions.net)

How do I populate a dropdown box from a xoops table?
Create a standard html form then add the following code:

$query $xoopsDB->query(' SELECT * FROM ' $xoopsDB->prefix('xoops_table'));
while (
$row $xoopsDB->fetchArray($query))
{
$sel $row['field1'];
$id =$row['field2'];
echo 
"$id'>$seln";
}
?>
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]."
"
;
//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">


The comments are owned by the author. We aren't responsible for their content.
user

 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...

 
user

 Re: Interesting


Quote:


A Propos - Tous droits réservés à Bahut.com © 2005 - XOOPS Ghost Reloaded - Contact


http://www.bahut.com/
Xoops Ghost Reloaded

 
user

 Please fix this page


I think this page is broken? 2 of the code examples are not displaying correctly?

 
user

 Think the idea was to write this..


Create a standard html form then add the following code:



$query 
$xoopsDB->query(' SELECT * FROM ' $xoopsDB->prefix('xoops_table'));

while (
$row $xoopsDB->fetchArray($query))
{
$sel $row['field1'];
$id =$row['field2'];
echo 
"$id'>$seln";
}
?>


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]."
"
;
//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">

 


Login

Who's Online

233 user(s) are online (1 user(s) are browsing XOOPS FAQ)


Members: 0


Guests: 233


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Did you know ?

A large number of XOOPS sites that are hacked are because the owner failed to set the correct file system permissions on critical XOOPS files and folders.

Random question

What is the difference between all the categories in the notification Options block of the forum module (Thread, Forum, Global)?