Can someone show me the correct code to display a group of checkbox values as part of an if statement? For example: in Programme One, lesson 100, lesson 310 and lesson 102 are available. In Programme Two, lesson 302, lesson 201, and lesson 102 are available. The "lesson types" are a checkbox group. I need to output the lesson types depending on whether they are part of Programme One or Two, along with other variables such as instructor student ratio.
I put the following code together where field_lessons is the checkbox group;
<?php
if ($fieldsObjects['field_type']->data == "Programme One") {
print '<p class="details_heading03">Instructor Student Ratio</p>';
echo $fieldsFormatted['field_student_ratio']. '<br />';
foreach ($fieldsObjects['field_lessons']->data as $name => $value) {
echo $value;
echo "<br/>";
}
else {
echo "no";
}
?>
I have also tried using this statement:
<?php
if ($fieldsObjects['field_type']->data == "Programme One") {
print '<p class="details_heading03">Instructor Student Ratio</p>';
echo $fieldsFormatted['field_student_ratio']. '<br />';
echo (isset($fieldsObjects['field_lessons']->data) &&
is_array($fieldsObjects['field_lessons']->data)) ?
}
else {
echo "no";
}
?>
I am new to php, and I am customising a template which is part of Sobi2, which has been installed as a component of Joomla! (CMS)?
Thank you
jo