Tassos Marinos Developer of Joomla Extensions

Run PHP with Convert Forms

Published in Convert Forms
Updated 18 Dec, 2023

Are you interested in adding custom PHP code to your Joomla forms? With the Convert Forms PHP app, executing PHP code after each form submission becomes a breeze. Write any PHP code you desire and it will automatically run each time someone submits your form.

This tutorial will guide you through using and configuring the PHP app in Convert Forms.

TABLE OF CONTENTS

Requirements

To use the PHP integration, there are a few requirements you need to meet, listed below:

  • Ensure you have Convert Forms Pro installed. You can easily upgrade to Pro if you're currently in the Free version
  • The "Convert Forms - Apps - PHP" plugin is enabled.

Setting Up PHP Task

To set up the PHP task and run your PHP code, go into your form, and follow the steps listed below:

Select App

From within your form, click on Tasks > CREATE YOUR FIRST TASK.

Create First Task

On the modal that will open, select the PHP task.

Select PHP Task

Select New Submission under Trigger and Run PHP under Action on the next screen, and click CONTINUE.

Select PHP Trigger and Action

Setup Action

After you've set up the trigger, and action, it's time to set up the action itself and provide your PHP code that will run when the form is successfully submitted.

Setup Action PHP Task

Add Conditional Logic

Conditional logic makes it possible to run tasks only if specific criteria are met, like a user’s email address matching a certain domain, the user being associated with a certain Joomla User Group, or a form submission having a specific value.

While editing the PHP task, go to the Setup Action step and scroll down to the Conditional Logic section to set up Conditional Logic. Here's where you define all the rules the task should meet to run.

For example, let's say we need to execute our PHP code, only if the email is coming from a specific domain: @domain.com.

  1. Click to enable the Run this task when certain conditions are met.
  2. Click Add Your First Condition.
  3. Select the Email field in the Trigger dropdown.
  4. Select Contains in the Operator dropdown.
  5. Enter @domain.com in the value. Replace this with your domain name.

The condition should look like this:

PHP Task Conditional Logic Example

You can read more on Conditional Logic on the Working with Tasks documentation page.

Activate Task

The final step is to enable our task. To do so, click the toggle on the dialog’s top right corner, as shown in the screenshot below.

Enable PHP Task

Finally, click Save to save the task, close the dialog, and then click Save from the top right corner of the form builder to save the changes on the form.

Congratulations! You’ve successfully created a form that executes your PHP code whenever the form is successfully submitted!