How to add a web form making changes in php files

In case there is a web form you need to add to your website and you wish to make changes in the php code itself, then the course of action depends on what kind of web form is in question:

  •  a built-in web form from amoCRM account
  • a web form created in amoforms WordPress plugin

 Case 1. Built-in form (from amoCRM account)

 In order to access a built-in web form you will need to go to:

  • leads
  • click on setup icon in the right-hand corner

  • click on “Form” in the opened window

  • form editor interface looks the following way:

 

In this case you will need to enter the following code to the php file:

echo "<script>var amo_forms_params = {id: form_id, hash: 'account_hash', locale: 'ru'};</script><script id="amoforms_script" async="async" src="https://forms.amocrm.com/forms/assets/js/amoforms.js"></script>";

where the values form_id and account_hash can be found in the form editor:

Case 2. Web form from amoforms plugin

In this case to a Wordpress function do_shortcode() is to be used. Here is an example:

<?php echo do_shortcode( '[amoforms id="1"]' ); ?>

The function has 2 parameters:

  • the short code of the form itself. In our example it is [amoforms id="1"]. The short code is provided in the plugin. «1» is the form id.

  • the second parameter is optional – it provides for ignoring html markup that is transmitted in the short code of the first parameter. In our example, this second parameter is not provided.

 

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.