I feel that this is something that should be apart of Machform by default, hopefully they can use what I have found and how I was able to integrate into Machform for future releases. But for now I'll give a quick overview.
We have quite a few forms built that have time and dates that are critical for reminding users of training, travel, inspections, etc...I was tasked with a way we could utilize or current forms and send a calendar appointment to remind them of these important dates and times along with details of the form inside a calendar appointment that would work with most email clients from outlook to the calendar app on our iPhones.
After doing some research and testing I have found a working solution that works incredibly well by dynamically creating a .ics calendar appointment and it really wasn't that hard to do.
I found this .php script! It was mostly done for me after reading through this GitHub post and coping the information they provided.
https://gist.github.com/jakebellacera/635416
So what I did was create a folder inside my machform folder called "cal" created 2 files inside the folder from the GitHub post called "download-ics.php" and "ics.php" since the original way the script was to work was based on a form post method in some html on a website (which wont work from an email) I did have to edit the "download-ics.php" from...
<?php
include 'ICS.php';
header('Content-type: text/calendar; charset=utf-8');
header('Content-Disposition: attachment; filename=invite.ics');
$ics = new ICS(array(
'location' => $_POST['location'],
'description' => $_POST['description'],
'dtstart' => $_POST['date_start'],
'dtend' => $_POST['date_end'],
'summary' => $_POST['summary'],
'url' => $_POST['url']
));
echo $ics->to_string();
to
<?php
include 'ICS.php';
header('Content-Type: text/calendar; charset=utf-8');
header('Content-Disposition: attachment; filename=invite.ics');
$ics = new ICS(array(
'location' => $_GET['location'],
'description' => $_GET['description'],
'dtstart' => $_GET['date_start'],
'dtend' => $_GET['date_end'],
'summary' => $_GET['summary'],
'url' => $_GET['url']
));
echo $ics->to_string();
Then I was able to use a link to the download-ics.php file with the form url parameters to generate a calendar reminder (.ics file) when the "Add to Calendar" button is clicked inside the confirmation email.
See my html code for link in an email.
<a href="https://whateveryourdomainnameis/download-ics.php?date_end={element_19}{element_20}{element_21} 16:00&date_start={element_19}{element_20}{element_21} 15:00&summary={element_1}&location={element_29}&description={element_6}">
<img alt="" class="auto-style13" height="41" src="https://whateveryourdomainnameis/button-icon-text-dark@2x.png" width="192"></a></td>
I know that was a lot of information to blast and may not be the clearest way to share, but if your serious about getting calendar reminders from your forms its a sure and easy way to do it. I thought this would be great for anybody wanting to send there users/customers reminders for any type of event with a simple button from their confirmation email.
If you need more info just ask.
Thanks,
Aaron