Hello all,
I've been racking my brain doing heavy research for an html form that when submitted, opens up a .vcs calendar event for outlook. I finally have it all working accept for a tiny issue that I'm not even sure is possible using php.
I want to be able to have it submit to 1 person without the client having to click "invite attendee" then fill in the "attendee". I would even be happy if it forced the "invite attendee" open and auto-filled it with the designated email, but thw person filling it out still needs to hit send.
Here's the code that forces the outlook calendar open and fills in all fields after a normal html form is filled in and submitted.
<?php
header("Content-Type: text/x-vCalendar");
header("Content-Disposition: inline; filename=MyvCalFile.vcs");
$timestamp = strtotime("Ymd");
$month = $_POST['month'];
$day = $_POST['day'];
$year = $_POST['year'];
$tomorrow = mktime(0,0,0, $month, $day+1, $year);
$vCalStart = date("Ymd", $tomorrow);
$vCalEnd = date("Ymd", $tomorrow);
print "BEGIN:VCALENDAR\n";
print "VERSION:1.0\n";
print "PRDID:RBC Web Calendar\n";
print "METHD:PUBLISH\n";
print "TZ:-08\n";
print "BEGIN:VEVENT\n";
print "DTSTART:".$vCalStart."\n";
print "DTEND:".$vCalEnd."\n";
print "ATTENDEE;CN=ckling@emailhere.com;ROLE=REQ-PARTICIPANT;RSVP=TRUE:MAILTO:ckling@emailhere.com\n"; //email submitted to
print "LOCATION:". ($_POST['hospital']) ."\n";
print "TRANSP:PAQUE\n";
print "UUID:".microtime()."\n";
print "DTSTAMP:".date('Ymd').'T'.date('His')."\n"; // required by Outlook
print "SUMMARY:".($_POST['name']) . "\n"; //subject line shows name field
print "DESCRIPTION;ENCODING=QUOTED-PRINTABLE: " . //description shows all fields
"--Contact Information:-- " . "=0D=0A" .
"Full Name: " . ($_POST['name']) . "=0D=0A" .
'Contact Phone #: ' . ($_POST['phone']) . "=0D=0A" .
'Hospital Scheduling Surgery for: ' . ($_POST['hospital']) . "=0D=0A" .
'Physician: ' . ($_POST['physician']) . "=0D=0A" .
'--Patient Information:-- ' . "=0D=0A" .
'Patient Name: ' . ($_POST['patient']) . "=0D=0A" .
'Patient Age: ' . ($_POST['age']) . "=0D=0A" .
'Patient Sex: ' . ($_POST['sex']) . "=0D=0A" .
'--Surgery Information:-- ' . "=0D=0A" .
'Date Requested: ' . ($_POST['month']) . ' ' . $_POST['day'] . ', ' .$_POST['year'] . "=0D=0A" .
'Time Range Requested: ' . ($_POST['time_range']) . "=0D=0A" .
'Type of Surgery: ' . ($_POST['surgery_type']) . "=0D=0A" .
'Side: ' . ($_POST['side']) . "=0D=0A" .
'Special Instructions: ' . ($_POST['special_instructions']) . "\n";
print "BEGIN:VALARM\n";
print "TRIGGER:PT15M\n";
print "ACTIN:DISPLAY\n";
print "END:VALARM\n";
print "END:VEVENT\n";
print "END:VCALENDAR\n";
exit;
?>
Any help would be greatly appreciated.
Maybe this will help someone else out also. I'm not the greatest at php so it's probably a mess