This tutorial shows how to use the standalone Scheduler for JavaScript version with PHP.
It includes a sample PHP project:
The sample PHP project is available for download.
<script type="text/javascript"> var dp = new DayPilot.Scheduler("dp"); // ... // http://api.daypilot.org/daypilot-scheduler-oneventmoved/ dp.onEventMoved = function (args) { DayPilot.request( "backend_move.php", function(req) { // success var response = eval("(" + req.responseText + ")"); if (response && response.result) { dp.message("Moved: " + response.message); } }, args, function(req) { // error dp.message("Saving failed"); } ); }; // ... dp.init(); </script>
backend_move.php
<?php require_once '_db.php'; $insert = "UPDATE events SET start = :start, end = :end, resource = :resource WHERE id = :id"; $stmt = $db->prepare($insert); $stmt->bindParam(':start', $start); $stmt->bindParam(':end', $end); $stmt->bindParam(':id', $id); $stmt->bindParam(':resource', $resource); $received = json_decode(file_get_contents('php://input')); $id = $received->e->id; $start = $received->newStart; $end = $received->newEnd; $resource = $received->newResource; $stmt->execute(); class Result {} $response = new Result(); $response->result = 'OK'; $response->message = 'Update successful'; echo json_encode($response); ?>