• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Drop down list from a database join

Drop down list from a database join 16 years 7 months ago #4682

Hi, I am new to RSForm!Pro and I cannot find any reference to how to create a dropdown list from an SQL database.

I have 237 country names and the associated ISO keys in an SQL table in the Joomla!157 database and I would like to access this to create a country selector in a form and post the relevant key to the data entry record.

How can I do this?

Can I do this in RSForm!Pro?

RTB.
Joomla! 1.5.7 Production/Stable [Wovusani]
Apache/2.2.9 (Win32) DAV/2 mod_ssl/2.2.9 OpenSSL/0.9.8h PHP/5.2.6
XAMPP for Windows v1.6.7 MySQL database v5.0.51b Zend Core v2.5.0
Windows NT 6.0 (Vista) build 6001 SP1
The administrator has disabled public write access.

Re:Drop down list from a database join 16 years 7 months ago #4688

  • dragonjc
  • dragonjc's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 151
Read knowledgeabse you will have your answer.
Component RS SHow Form in build
The administrator has disabled public write access.

Re:Drop down list from a database join 16 years 7 months ago #4692

OK, thanks, I found it under auto-populate a list from a table.

Attached is a screen capture of my SQL database.


Can you tell me why...

//<code>
$items = \"|Please Select[c]n\";
$rez = mysql_query(\"SELECT iso,countries_name FROM jos_form_countries\");
while($r = mysql_fetch_assoc($rez))
$items .= $r . '|' . $r . \"/n\";
return $items;
//</code>

...just produces an empty box. It doesn't seem to find the database and it doesn't produce even a \"Please Select\" in the drop down window.

Do I have to buy a plug-in or something to try it out?

RTB.

Post edited by: RupertTHEbare, at: 2008/09/16 13:48<br><br>Post edited by: RupertTHEbare, at: 2008/09/16 13:52
Attachments:
Joomla! 1.5.7 Production/Stable [Wovusani]
Apache/2.2.9 (Win32) DAV/2 mod_ssl/2.2.9 OpenSSL/0.9.8h PHP/5.2.6
XAMPP for Windows v1.6.7 MySQL database v5.0.51b Zend Core v2.5.0
Windows NT 6.0 (Vista) build 6001 SP1
The administrator has disabled public write access.

Re:Drop down list from a database join 16 years 7 months ago #4693

OK, I have found the problem. It is working now.

There seems to be something crazy going on here with my magic quotes and the \"\\n\". If I enter \"\\n\" on screen I only get \"\n\" in the script.

Its odd because magic quotes are set to off... :S

RTB.
Joomla! 1.5.7 Production/Stable [Wovusani]
Apache/2.2.9 (Win32) DAV/2 mod_ssl/2.2.9 OpenSSL/0.9.8h PHP/5.2.6
XAMPP for Windows v1.6.7 MySQL database v5.0.51b Zend Core v2.5.0
Windows NT 6.0 (Vista) build 6001 SP1
The administrator has disabled public write access.

Re:Drop down list from a database join 16 years 7 months ago #4694

RupertTHEbare wrote:
OK, I have found the problem. It is working now.

There seems to be something crazy going on here with my magic quotes and the \"\\n\". If I enter \"\\n\" on screen I only get \"\n\" in the script.

Its odd because magic quotes are set to off... :S

RTB.

Its done it again. Something is deleting my back-slashes -- maybe its Zend?
Joomla! 1.5.7 Production/Stable [Wovusani]
Apache/2.2.9 (Win32) DAV/2 mod_ssl/2.2.9 OpenSSL/0.9.8h PHP/5.2.6
XAMPP for Windows v1.6.7 MySQL database v5.0.51b Zend Core v2.5.0
Windows NT 6.0 (Vista) build 6001 SP1
The administrator has disabled public write access.

Re:Drop down list from a database join 16 years 7 months ago #4700

  • dragonjc
  • dragonjc's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 151
The problem is not resolve, ask support. I have the same problem since a long time and don't find solution. So i have try other thing.
Component RS SHow Form in build
The administrator has disabled public write access.

Re:Drop down list from a database join 16 years 7 months ago #4701

I have found a way round the problem but I still do not know what is causing it. However, if wherever you see in script one backslash you make sure you enter three backslashes, one still remains on processing the form. If you edit the script though, you will have to check and re-enter another two backslashes, so you have three again, before you save the script.

RTB.<br><br>Post edited by: terence.milbourn, at: 2008/09/17 14:46
State Records US - The most comprehensive and user-friendly Public Records and People Search access anywhere on the Internet.
The administrator has disabled public write access.

Re:Drop down list from a database join 15 years 10 months ago #7744

  • dmmsmith
  • dmmsmith's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 9
Hi
I am having the same problem, i have created a table, put my script in the called on form display and what i get is an empty box. It looks like the countries are all there with a large sroll to the bottom of the box but it is emtpy. I have followed the instructions in the documentation but I am missing something because it is coming up empty. This is what I have put in the called on form display.
foreach($fields as $i=>$field){
    if($field->name=='countryselect'){
        $database->setQuery("SELECT iso,countries_name FROM jos_form_countries");
        $values = $database->loadObjectList();
        $default_value = array();
        foreach($values as $row){
            $default_value[]= $row->val.'|'.$row->txt;
        }
        $default_value = implode(',',$default_value);
        $fields[$i]->default_value = $default_value;
    }
}

I have magic quotes on and am using RSForm!Lite.

I have tried to replace " with " but then I get this error

Parse error: syntax error, unexpected ';', expecting T_PAAMAYIM_NEKUDOTAYIM in .../components/com_forme/forme.html.php(34) : eval()'d code on line 3

I have tried everything suggested in all threads related to this topic but nothing is working.

Any ideas on how to resolve this?
Last Edit: 15 years 10 months ago by dmmsmith.
The administrator has disabled public write access.

Re:Drop down list from a database join 15 years 10 months ago #7835

  • dmmsmith
  • dmmsmith's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 9
Any ideas??! Its a basic function- so basic it is included in 1 of the 3 how tos of the documentation!

Surely this has worked somehow??!!
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!