Overview
This guide explains how to execute PHP code within ChronoForms 8 and store the output in a variable for use in other form actions or views. It provides step-by-step instructions, from adding the PHP action to the form's Load event to configuring the code and referencing the variable using the {var:action_name} syntax. By following these steps, you can dynamically integrate PHP results into form elements like message fields.
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:
- Open your form for editing and switch to the "Actions" list on the right side panel
- Find the PHP action under the Basics group
- Drag the PHP action to the form's Load event, as we will be using it's result in the Message field.

- Click the new dragged PHP action config icon to start changing it's settings
- 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.
- 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.

- Close the PHP action settings and open the Message field Textarea settings
- Enable the Placeholder in the Behaviors
- 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:


Comments: