• 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: sql linked list in dropdown

sql linked list in dropdown 12 years 6 months ago #19160

  • exlineo
  • exlineo's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 1
Hi,
i have a dropdown list region which contain departments
//<code>
$items = "|Choisissez un département[c]\n";
$db =& JFactory::getDBO();
$db->setQuery("SELECT id, type_name FROM jos_muscol_type ORDER BY type_name");
$result = $db->loadObjectList();
 
foreach ($result as $r)
      $items .= $r->id . '|' . $r->type_name . "\n";
 
return $items;
//</code> 

i'd like that the second dropdown list (villes) show only cities of the selected departement so i try to get the region value in a variable $idr.

i've tried
$idr = isset($_POST['region'])?$_POST['region']:null;
or $idr = {region:value}; or
but doesn't work.
I'd like to know if i must define $idr in region or ville default value ?
and what is the code to define $idr ?

ville dropdown:
//<code>
$items = "|Toutes les communes[c]\n";
$db =& JFactory::getDBO();
$db->setQuery("SELECT id, tag_name FROM jos_muscol_tags WHERE departement = $idr ORDER BY tag_name");
$result = $db->loadObjectList();
 
foreach ($result as $r)
      $items .= $r->id . '|' . $r->tag_name . "\n";
$idr= $r->id;
return $items;
//</code>

Any help would be appreciate.
Regards
Céline
Last Edit: 12 years 6 months ago by exlineo.
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!