# Can I create a calculated field using PHP on a form?

**URL:** <https://forum.mautic.org/t/can-i-create-a-calculated-field-using-php-on-a-form/10602>\
**Category:** Product Support\
**Created:** [June 21, 2018, 6:43am UTC](https://forum.mautic.org/t/can-i-create-a-calculated-field-using-php-on-a-form/10602 "2018-06-21T06:43:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnbyrne](https://avatars.discourse-cdn.com/v4/letter/j/e36b37/32.png) [@johnbyrne](https://forum.mautic.org/u/johnbyrne)\
**Post date:** [June 21, 2018, 6:43am UTC](https://forum.mautic.org/t/can-i-create-a-calculated-field-using-php-on-a-form/10602/1 "2018-06-21T06:43:50Z")

</div>

Hi,

I use Mautic to capture registrations for my webinar system and I would like to create a calculated field (most likely a hidden field, but might not be) that I can create using a php script that concatenates a number, email address, and the contact’s first name and then encodes it using base64 encoding. I can do all this in PHP, but I’m not sure about how to include this in a Mautic form, so that the result ends up as a custom field in the database.

Can anyone help me?

Thanks in advance,

John

---

<div class="post-metadata">

**Author:** ![johnbyrne](https://avatars.discourse-cdn.com/v4/letter/j/e36b37/32.png) [@johnbyrne](https://forum.mautic.org/u/johnbyrne)\
**Post date:** [June 21, 2018, 6:45am UTC](https://forum.mautic.org/t/can-i-create-a-calculated-field-using-php-on-a-form/10602/2 "2018-06-21T06:45:02Z")

</div>

Would I be better off to capture the information in an external form and then have it submit to Mautic?

John

---

<div class="post-metadata">

**Author:** ![mrfromgermany](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mrfromgermany/32/433_2.png) [@mrfromgermany](https://forum.mautic.org/u/mrfromgermany)\
**Post date:** [June 21, 2018, 7:18am UTC](https://forum.mautic.org/t/can-i-create-a-calculated-field-using-php-on-a-form/10602/3 "2018-06-21T07:18:53Z")

</div>

I use a german wordpress plugin for automated/simulated webinars to send the webinar details to a mautic formular with using a http-post request. The request lookes like:

[https://my-mautic-sinatllation.de/form/submit?formId=1&mauticform[vorname]=[firstName]&mauticform[nachname]=[lastName]&mauticform[webinaremail]=[email]&mauticform[mobilfunknummer]=[mobilePhone]&mauticform[formId]=1&mauticform[webinartermin]=[txtDateNormal],[txtTime](https://my-mautic-sinatllation.de/form/submit?formId=1&mauticform%5Bvorname%5D=%5BfirstName%5D&mauticform%5Bnachname%5D=%5BlastName%5D&mauticform%5Bwebinaremail%5D=%5Bemail%5D&mauticform%5Bmobilfunknummer%5D=%5BmobilePhone%5D&mauticform%5BformId%5D=1&mauticform%5Bwebinartermin%5D=%5BtxtDateNormal%5D,%5BtxtTime)]&mauticform[affiliate]=[aff]

Instead of “mauticform[vorname]” you have to use the fields names you can see in your own form-html-code.

If you have a external form and a php-script which uses also a http-post request, this would also work and you do not need to use the mautic api. But you need to use “kiosk mode” for the mautic form, because the request will always come from the same ip from your webserver.

---

<div class="post-metadata">

**Author:** ![johnbyrne](https://avatars.discourse-cdn.com/v4/letter/j/e36b37/32.png) [@johnbyrne](https://forum.mautic.org/u/johnbyrne)\
**Post date:** [June 21, 2018, 8:03am UTC](https://forum.mautic.org/t/can-i-create-a-calculated-field-using-php-on-a-form/10602/4 "2018-06-21T08:03:08Z")

</div>

Thanks Matthias,

I got it working. I am extremely happy!

Thanks again for your swift reply.

John
