php - Price calculator by each hour -
php - Price calculator by each hour -
i'm making pricing calculator adds difference between 2 dates. standard cost $500.00 amount of hours (example 3 hours). if difference on minimum hour, add together $100.00 standard price.
i used php generate cost in email when total time posted.
// html
<label>start date & time</label> <input type="datetime" id="time2" name="start" data-bind="value: start, valueupdate:'keyup'" required="required" placeholder="dd/mm/yyyy hh:mm:ss or pm"> <label class="label">end date & time</label> <input type="datetime" id="time1" name="end" data-bind="value: end, valueupdate:'keyup'" placeholder="dd/mm/yyyy hh:mm:ss or pm" required="required"> <label class="label">time total:</label> <input type="text" name="difference" id="difference" data-bind="value: difference">
the difference generated dynamically moment.js , knockout keyup.
// php <?php $start = $_post['start']; $end = $_post['end']; $difference = (int)$_get['difference']; // time calculator $standardrate = 500; $addhour = 100; $minimum = 3; if ($difference > $minimum) { $hour = $difference - $minimum; homecoming $standardrate = ceil($hour * $addhour) + $standardrate; } else { homecoming $standardrate; } $email_content .= "price: $standardrate\n\n"; ?>
am doing calculation correctly?
php knockout.js momentjs
Comments
Post a Comment