Mautic Community Forums

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

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

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

John

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]&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.

Thanks Matthias,

I got it working. I am extremely happy!

Thanks again for your swift reply.

John