Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action("gform_pre_submission_2","pre_submission_handler");
- function pre_submission_handler($form) {
- $format = '%r';
- $start = $_POST["input_1"];
- $end = $_POST["input_2"];
- $startA = strtoupper($start[2]);
- $endP = strtoupper($end[2]);
- $startdate = $start[0].':'.$start[1].' '.$startA;
- $enddate = $end[0].':'.$end[1].' '.$endP;
- $starttime = strptime($startdate, $format);
- $endtime = strptime($enddate, $format);
- $hours = (($endtime['tm_min'] + ($endtime['tm_hour'] * 60)) / 60) - (($starttime['tm_min'] + ($starttime['tm_hour'] * 60)) / 60);
- $_POST["input_3"] = $hours;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement