# Remembering the date when form is submitted in custom field

**URL:** <https://forum.mautic.org/t/remembering-the-date-when-form-is-submitted-in-custom-field/4341>\
**Category:** Product Support\
**Created:** [June 8, 2016, 10:32pm UTC](https://forum.mautic.org/t/remembering-the-date-when-form-is-submitted-in-custom-field/4341 "2016-06-08T22:32:30Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![goran](https://avatars.discourse-cdn.com/v4/letter/g/a6a055/32.png) [@goran](https://forum.mautic.org/u/goran)\
**Post date:** [June 8, 2016, 10:32pm UTC](https://forum.mautic.org/t/remembering-the-date-when-form-is-submitted-in-custom-field/4341/1 "2016-06-08T22:32:30Z")

</div>

Hi,  
  
  
  
I’m trying to remember the date when the form i made in mautic is submitted in custom field.  
  
  
  
Basically, when user submits the form the date of submission needs to be saved in some custom field. Also this has to happen automatically, user should not be forced to type in the date.  
  
  
  
How can i do that with mautic?  
  
  
  
Thanks!

---

<div class="post-metadata">

**Author:** ![petertl](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/petertl/32/511_2.png) [@petertl](https://forum.mautic.org/u/petertl)\
**Post date:** [June 14, 2016, 11:23am UTC](https://forum.mautic.org/t/remembering-the-date-when-form-is-submitted-in-custom-field/4341/2 "2016-06-14T11:23:35Z")

</div>

I have exactly the same requirement (to store an opt-in date in the database).

My approach would be (not tested):

1. Create a hidden field in the form and map it to a lead field
2. Choose manual copy for the form HTML
3. Add a \<?php getdate() ?\> in the form field value
4. Paste the form HTML to your target page
5. Make sure PHP code can be executed

---

<div class="post-metadata">

**Author:** ![goran](https://avatars.discourse-cdn.com/v4/letter/g/a6a055/32.png) [@goran](https://forum.mautic.org/u/goran)\
**Post date:** [June 8, 2016, 10:32pm UTC](https://forum.mautic.org/t/remembering-the-date-when-form-is-submitted-in-custom-field/4341/3 "2016-06-08T22:32:30Z")

</div>

Hi,

I’m trying to remember the date when the form i made in mautic is submitted in custom field.

Basically, when user submits the form the date of submission needs to be saved in some custom field. Also this has to happen automatically, user should not be forced to type in the date.

How can i do that with mautic?

Thanks!

---

<div class="post-metadata">

**Author:** ![wbuist](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/wbuist/32/21_2.png) [@wbuist](https://forum.mautic.org/u/wbuist)\
**Post date:** [November 15, 2016, 3:12pm UTC](https://forum.mautic.org/t/remembering-the-date-when-form-is-submitted-in-custom-field/4341/4 "2016-11-15T15:12:46Z")

</div>

I approached this by adding a custom field and then adding a trigger to the database

I wanted to know about new leads but it would be easy to adapt this for existing ones too.

CREATE TRIGGER `add_date` BEFORE INSERT ON `mautic_leads`  
FOR EACH  
ROW SET new.applicationdate = CURDATE( )

---

<div class="post-metadata">

**Author:** ![DutchAlfred](https://avatars.discourse-cdn.com/v4/letter/d/aca169/32.png) [@DutchAlfred](https://forum.mautic.org/u/DutchAlfred)\
**Post date:** [December 11, 2016, 3:16pm UTC](https://forum.mautic.org/t/remembering-the-date-when-form-is-submitted-in-custom-field/4341/5 "2016-12-11T15:16:53Z")

</div>

Dear Wbuist, this is exactly what I am looking for. I want to make use of the same form on different pages. On each of these pages I have a custom field called ‘Formtag’, e.g. on [http://www.allianceexperts.com/en/ten/find-agent-distributor-exports-poland/](http://www.allianceexperts.com/en/ten/find-agent-distributor-exports-poland/).

Could you explain in a few more steps for this ‘beginner’ how you would get the contents of this custom field in Wordpress with the contact record? I have already created a Custom field in Mautic for it: ‘Source’.

---

<div class="post-metadata">

**Author:** ![wbuist](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/wbuist/32/21_2.png) [@wbuist](https://forum.mautic.org/u/wbuist)\
**Post date:** [December 11, 2016, 5:56pm UTC](https://forum.mautic.org/t/remembering-the-date-when-form-is-submitted-in-custom-field/4341/6 "2016-12-11T17:56:39Z")

</div>

The solution above works to get the data into the Mautic record rather than a Wordpress custom field. I’m not sure of the best approach to the issue you are seeking to solve.

---

<div class="post-metadata">

**Author:** ![nickbuc](https://avatars.discourse-cdn.com/v4/letter/n/e36b37/32.png) [@nickbuc](https://forum.mautic.org/u/nickbuc)\
**Post date:** [January 3, 2017, 7:57pm UTC](https://forum.mautic.org/t/remembering-the-date-when-form-is-submitted-in-custom-field/4341/7 "2017-01-03T19:57:07Z")

</div>

@wbuist Thanks a lot for your post from Nov 15. Could you please send detailed steps about how and where you use this to automatically enter the current date in a custom Mautic field?

Thanks a lot!

---

<div class="post-metadata">

**Author:** ![wbuist](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/wbuist/32/21_2.png) [@wbuist](https://forum.mautic.org/u/wbuist)\
**Post date:** [January 3, 2017, 8:28pm UTC](https://forum.mautic.org/t/remembering-the-date-when-form-is-submitted-in-custom-field/4341/8 "2017-01-03T20:28:39Z")

</div>

@nickbuc Hi Nick, Firstly you need to add a field to the contact record in Mautic. I called it Application date.

Then I logged on to PHPMyadmin and navigate to the Mautic database and set up the trigger with this code:

CREATE TRIGGER `add_date` BEFORE INSERT ON `mautic_leads`  
FOR EACH  
ROW SET new.applicationdate = CURDATE( )

HTH

---

<div class="post-metadata">

**Author:** ![DutchAlfred](https://avatars.discourse-cdn.com/v4/letter/d/aca169/32.png) [@DutchAlfred](https://forum.mautic.org/u/DutchAlfred)\
**Post date:** [February 16, 2017, 5:06am UTC](https://forum.mautic.org/t/remembering-the-date-when-form-is-submitted-in-custom-field/4341/9 "2017-02-16T05:06:11Z")

</div>

Hi wbuist, if you can do this with the date, is it also possible to do this with the url of the page where the form is? That would help me a lot. I refer to the same forms from various pages such as [here](http://www.allianceexperts.com/en/ten/find-agent-distributor-in-germany/), [here](http://www.allianceexperts.com/en/ten/find-agent-distributor-in-japan/) and [here](http://www.allianceexperts.com/en/ten/find-agent-distributor-export-russia/), but would like to be able to distinguish where the contact comes from.

---

<div class="post-metadata">

**Author:** ![DutchAlfred](https://avatars.discourse-cdn.com/v4/letter/d/aca169/32.png) [@DutchAlfred](https://forum.mautic.org/u/DutchAlfred)\
**Post date:** [February 17, 2017, 6:52am UTC](https://forum.mautic.org/t/remembering-the-date-when-form-is-submitted-in-custom-field/4341/10 "2017-02-17T06:52:03Z")

</div>

I followed your instructions and also went to PhpMyadmin, where I found the option of Add Trigger. The only point is that I get a syntax error. Could you please point out what I’m doing wrong. I’m using the standard field ‘Attribution date’ to get the date there, as in your example.

![](http://www.allianceexperts.com/images/Mautic1.png)

---

<div class="post-metadata">

**Author:** ![ServicesMary](https://avatars.discourse-cdn.com/v4/letter/s/8797f3/32.png) [@ServicesMary](https://forum.mautic.org/u/ServicesMary)\
**Post date:** [March 2, 2017, 7:54am UTC](https://forum.mautic.org/t/remembering-the-date-when-form-is-submitted-in-custom-field/4341/11 "2017-03-02T07:54:00Z")

</div>

Hi,  
@DutchAlfred  
Just put SET new.applicationdate = CURDATE( ), delete FOR EACH ROW
