Unfortunately, the username and password you have entered do not match!

Registration

Unfortunately, this username is already taken!

Unfortunately, this e-mail address is already used!

Please retype the verification code.

All fields are required

RSForm!Pro - Auto-populate a list from a table

Auto-populate a list from a table
In this article we will describe how to auto-populate a list with items from a table of your choice.

In order to achieve this you will have to create a new "Drop-down" component, lets say "test".

In the "Items" are paste the following code:

//<code>
$items = "|Please Select[c]\n";
$db =& JFactory::getDBO();
$db->setQuery("SELECT your_value, your_label FROM your_table");
$result = $db->loadObjectList();

foreach ($result as $r)
      $items .= $r->your_value . '|' . $r->your_label . "\n";

return $items;
//</code>

Note:

If you have magic quotes activated you will need to use "\\n" instead of "\n".
Feedback