How to use PHP data anywhere in your form

Discover how to use PHP in your ChronoForms8 Joomla form and how to transform other form elements using returned variables.

In ChronoForms 8 you can run PHP code, capture the results in a variable then use the results in later actions or views in your form using the {var:php_action_name}, here are the steps to do this:

  1. Open your form for editing and switch to the "Actions" list on the right side panel
  2. Find the PHP action under the Basics group
  3. Drag the PHP action to the form's Load event, as we will be using it's result in the Message field.

  1. Click the new dragged PHP action config icon to start changing it's settings
  2. In the Code box, write whatever PHP code you need to run with OUT PHP tags <?php & ?>, and in order to set the PHP results as a Chrono variable, we need to use the "return" php statement.
  3. Pay attention to the PHP action name, because this is how the Chrono variable will be named, here the default name is "php9", but you can change it in the Wizard Settings behavior.

  1. Close the PHP action settings and open the Message field Textarea settings
  2. Enable the Placeholder in the Behaviors
  3. Set the Placeholder value to {var:php9}, the syntax for calling any Chronoforms variable is {var:name_of_action}

Save the form and check the result:

Category: ChronoForms v8

VPS & Email Hosting 20% discount
hostinger