# Submit data to Mautic \[via form\]

**URL:** <https://forum.mautic.org/t/submit-data-to-mautic-via-form/2378>\
**Category:** Product Support\
**Created:** [September 21, 2015, 7:46pm UTC](https://forum.mautic.org/t/submit-data-to-mautic-via-form/2378 "2015-09-21T19:46:33Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ninjoan](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ninjoan/32/1005_2.png) [@ninjoan](https://forum.mautic.org/u/ninjoan)\
**Post date:** [September 21, 2015, 7:46pm UTC](https://forum.mautic.org/t/submit-data-to-mautic-via-form/2378/1 "2015-09-21T19:46:33Z")

</div>

Hi i know our good friend John Linhart published a post on Medium about it [](https://medium.com/@jan_linhart/the-simplest-way-how-to-submit-a-form-data-to-mautic-1454d3afd005)  
  
But like me there are so many user that are not programmer… ![:(]( ":(")  
  
  
  
So if we can be more clear in the steps to make our beautiful app Mautic work in our company and have a space in our hearts please lets try to figure out a way to do it.  
  
  
  
Here is the script code publish by John.

Code:

\<?php /\*\* \* Push data to a Mautic form \* \* @param array $data The data submitted by your form \* @param integer $formId Mautic Form ID \* @param string $ip IP address of the lead \* @return string \*/ function pushMauticForm($data, $formId, $ip) { $data['formId'] = $formId; // return has to be part of the form data array if (!isset($data['return'])) { $data['return'] = 'http://where-to-redirect.com'; }

```
$data = array('mauticform' => $data);
// Change [path-to-mautic] to URL where your Mautic is
$formUrl = 'http://[path-to-mautic]/form/submit?formId=' . $formId;

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $formUrl);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, array("HTTP_X_FORWARDED_FOR: $ip"));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);

curl_close($ch);
return $response;     

```

}

  
Now we wanna know what field we have to change to make this beutifull script code work for us.

---

<div class="post-metadata">

**Author:** ![ninjoan](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ninjoan/32/1005_2.png) [@ninjoan](https://forum.mautic.org/u/ninjoan)\
**Post date:** [September 21, 2015, 7:46pm UTC](https://forum.mautic.org/t/submit-data-to-mautic-via-form/2378/2 "2015-09-21T19:46:33Z")

</div>

Hi i know our good friend John Linhart published a post on Medium about it [](https://medium.com/@jan_linhart/the-simplest-way-how-to-submit-a-form-data-to-mautic-1454d3afd005)  
But like me there are so many user that are not programmer… ☹

So if we can be more clear in the steps to make our beautiful app Mautic work in our company and have a space in our hearts please lets try to figure out a way to do it.

Here is the script code publish by John.

[code]\<?php  
/\*\*

- Push data to a Mautic form

- 
- @param array $data The data submitted by your form

- @param integer $formId Mautic Form ID

- @param string $ip IP address of the lead

- @return string  
\*/  
function pushMauticForm($data, $formId, $ip)  
{  
$data[‘formId’] = $formId;  
// return has to be part of the form data array  
if (!isset($data[‘return’])) {  
$data[‘return’] = ‘[http://where-to-redirect.com](http://where-to-redirect.com)’;  
}

Now we wanna know what field we have to change to make this beutifull script code work for us.

---

<div class="post-metadata">

**Author:** ![escopecz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/escopecz/32/370_2.png) [@escopecz](https://forum.mautic.org/u/escopecz)\
**Post date:** [September 23, 2015, 3:48pm UTC](https://forum.mautic.org/t/submit-data-to-mautic-via-form/2378/3 "2015-09-23T15:48:43Z")

</div>

I don’t want to be rude or something, but if you want to connect 2 different systems together, you need a person with the skills to do that. That person has to know both systems and some programming. You didn’t even mention what the second system is.

You don’t need to change anything in that script. It’s ready to use. You just have to paste it to the right place and call that function with correct parameters.

As usually in many other areas of life, you have 2 choices:

1. Learn it and do it yourself.
2. Pay somebody who has the skills to do it for you.

---

<div class="post-metadata">

**Author:** ![ninjoan](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ninjoan/32/1005_2.png) [@ninjoan](https://forum.mautic.org/u/ninjoan)\
**Post date:** [September 25, 2015, 10:44pm UTC](https://forum.mautic.org/t/submit-data-to-mautic-via-form/2378/4 "2015-09-25T22:44:36Z")

</div>

@escopecz i only wanna is you mark me with a yellow text the variable i have to change ☹

---

<div class="post-metadata">

**Author:** ![escopecz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/escopecz/32/370_2.png) [@escopecz](https://forum.mautic.org/u/escopecz)\
**Post date:** [September 28, 2015, 7:15am UTC](https://forum.mautic.org/t/submit-data-to-mautic-via-form/2378/5 "2015-09-28T07:15:29Z")

</div>

```auto
You don't need to change anything in that script. It's ready to use. You just have to paste it to the right place and call that function with correct parameters.
```

It’s a function. All you have to do is to call it with the parameters. Example of how to call it is in the Medium article.

---

<div class="post-metadata">

**Author:** ![Sokoban](https://avatars.discourse-cdn.com/v4/letter/s/9dc877/32.png) [@Sokoban](https://forum.mautic.org/u/Sokoban)\
**Post date:** [October 6, 2015, 1:00am UTC](https://forum.mautic.org/t/submit-data-to-mautic-via-form/2378/6 "2015-10-06T01:00:31Z")

</div>

@ninjoan , did you succeed configuring PHP script? Did it run alright? Where did you paste? Did you create any file .php?

---

<div class="post-metadata">

**Author:** ![silavapi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/silavapi/32/7424_2.png) [@silavapi](https://forum.mautic.org/u/silavapi)\
**Post date:** [February 2, 2020, 10:57pm UTC](https://forum.mautic.org/t/submit-data-to-mautic-via-form/2378/7 "2020-02-02T22:57:57Z")

</div>


