How to generate a date limit value in email confirmation?

faraon 29 Oct, 2013
For a registration form that sends automatically a gift certificate with limited use date, I am looking for a simple way to add to the confirmation email a field that would calculate automatically this date equivalent to the registration date +21 days.
Any tutorial for this?
Thanks for your help.
GreyHead 30 Oct, 2013
Hi faraon,

I found this StackOverFlow answer that you can use in a Custom Code action.
<?php
$date = strtotime("+21 day");
$form->data['expires'] = date('M d, Y', $date);
?>
Then use {expires} in the Email template.
Bob
faraon 31 Oct, 2013
Thanks a lot Bob, looks like the solution, but unfortunately I used "Custom Element (HTML/PHP)" and it does not work.
It does not reflect in the email any value (or even if I try the confirmation message)...
GreyHead 31 Oct, 2013
Hi faraon,

Please try putting it into a Custom Code action in the On Submit event of your form (or the Custom Code Before Email box if you are using the Easy Wizard).

Bob
faraon 01 Nov, 2013
Excellent, works great!
Thanks a lot.
This topic is locked and no more replies can be posted.