From 523a84dd4b7cb611955e949fd6debc4a3c037b91 Mon Sep 17 00:00:00 2001 From: "David T. Sadler" Date: Mon, 11 Oct 2021 21:49:47 +0100 Subject: Implement very basic editing --- public/edit/index.php | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 public/edit/index.php (limited to 'public') diff --git a/public/edit/index.php b/public/edit/index.php new file mode 100644 index 0000000..0cc1c27 --- /dev/null +++ b/public/edit/index.php @@ -0,0 +1,33 @@ +load(); + +$bookmark = $bookmarks->find($id); + +if ('POST' === filter_input(INPUT_SERVER, 'REQUEST_METHOD')) { + $bookmark->url = $_POST['url']; + $bookmark->title = $_POST['title']; + $bookmark->tag = $_POST['tag']; + + $bookmarks->update($bookmark); +} + +$html = $template->render('edit', compact('bookmark')); + +respondAndExit(200, 'OK', $html); -- cgit v1.2.3-13-gbd6f