1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
<?php switch ($_REQUEST['action']) { case 'add_event': $events = json_decode(file_get_contents('event.json'), TRUE);
if (!empty($_POST['title'])) { $new_event = array( 'title' => $_POST['title'], 'start' => $_POST['start'], 'end' => $_POST['end'], 'description' => $_POST['description'], 'contact_person' => $_POST['contact_person'], 'contact_details' => $_POST['contact_details'], ); array_push($events, $new_event); }
file_put_contents('event.json', json_encode($events));
break; }
|