Forums

php variables

tony_midoztouch 19 Dec, 2023
Hi all

I'm after some simple examples of how to display content based on answers in specific fields.

All I want to do is something simple like:

if ({data:BO_Q1}<> 'Yes')
echo "Question 1 is Marked as No or Unsure";

I can't seem to find any documentation on how the php variables are called, or in fact very much documentation on the php feature more broadly.

Any assistance to point me in the right direction would be gratefully received.
Max_admin 19 Dec, 2023
Answer
in a PHP action:

if($this->data("BO_Q1") == "Yes"){
echo "Question 1 is Marked as No or Unsure";
}


but that would just show a text, if you want to render a View or a Message instead then enable the PHP action "Events behavior", and return an event name:

if($this->data("BO_Q1") == "Yes"){
return "yes";
}

Now, add the "yes" event to the Events behavior then save the form, and add any actions you want to run in the "yes" event.
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
You need to login to be able to post a reply.