Ecovoyageurs
Member
Hello,
Me again, sorry, but I'm surely getting better at fabriking, thanks to you !!
I saw tutorials, wikis and many posts related to this but couldn't figure out how to set up my own things.
I have 2 tables (both created by another component than Fabrik) :
- "months" is storing all possible months (well "all" should be 12 !)
- "trip_months" is storing possible months for a trip like this : *january*february*march* (it is a checkbox element in my component)
Now I want to grab my values in Fabrik :
- In my Fabrik "trips" form, I created a dbjoin element linked to months table and now have my (12) months rendered as checkboxes with values like january, february, march, april and so on....
- I want to select default months based on a trip previously selected by another dbjoin element in the same form
I tried this in eval box :
See... it doesn't work... but I'm not the king of PHP...
Thanks for any help
Me again, sorry, but I'm surely getting better at fabriking, thanks to you !!
I saw tutorials, wikis and many posts related to this but couldn't figure out how to set up my own things.
I have 2 tables (both created by another component than Fabrik) :
- "months" is storing all possible months (well "all" should be 12 !)
- "trip_months" is storing possible months for a trip like this : *january*february*march* (it is a checkbox element in my component)
Now I want to grab my values in Fabrik :
- In my Fabrik "trips" form, I created a dbjoin element linked to months table and now have my (12) months rendered as checkboxes with values like january, february, march, april and so on....
- I want to select default months based on a trip previously selected by another dbjoin element in the same form
I tried this in eval box :
PHP:
$db = JFactory::getDbo();
$fk = $db->Quote('{trips___trip_id_raw}');
$query = "SELECT tripmonths FROM trip_months WHERE tripid = $fk)";
$db->setQuery($query);
$monthslistarray = $db->loadResult();
$monthslist = explode("*", $monthslistarray);
foreach ($monthslist as $month)
{
$selected[] = $month;
}
See... it doesn't work... but I'm not the king of PHP...
Thanks for any help