diff options
| author | Mathias Magnusson <mathias@magnusson.space> | 2025-09-23 00:07:35 +0200 |
|---|---|---|
| committer | Mathias Magnusson <mathias@magnusson.space> | 2025-09-23 00:07:35 +0200 |
| commit | c70851504652267c95194a98756c6875271cdda7 (patch) | |
| tree | 2c7cd22ad17567e907d36ccf76d7fcad6073a6e1 /public/omdömen/edit.php | |
| parent | a2827963fbf6847166360be635c65dc85d20dd0d (diff) | |
| download | traedgaardstomten-c70851504652267c95194a98756c6875271cdda7.tar.gz | |
Implement reviews
Diffstat (limited to 'public/omdömen/edit.php')
| -rw-r--r-- | public/omdömen/edit.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/public/omdömen/edit.php b/public/omdömen/edit.php new file mode 100644 index 0000000..00b2d3b --- /dev/null +++ b/public/omdömen/edit.php @@ -0,0 +1,33 @@ +<?php +require "../../include/sqlite.php"; + +session_start(); + +if (!isset($_SESSION["editable review"])) die("Kan ej redigera något omdöme."); + +$rowid = $_SESSION["editable review"]; +$res = query('select name, content from reviews where rowid = ?', $rowid); +$review = (object) $res->fetchArray(); + +if ($_SERVER["REQUEST_METHOD"] === "POST") { + $name = $_POST["name"]; + $content = $_POST["content"]; + + query("update reviews set name = ?, content = ? where rowid = ?", $name, $content, $rowid); + + header("HX-Redirect: /omd%c3%b6men/"); + exit; +} + +require "../../include/layout.php"; layout($_); +?> + +<form hx-post="/omdömen/edit/"> + <label for="name">Namn:</label> + <input type="text" name="name" id="name" value="<?= htmlspecialchars($review->name) ?>"> + <br> + <label for="content" style="vertical-align: top">Omdöme:</label> + <textarea name="content" id="content" style="height: 10em; width: 20em"><?= htmlspecialchars($review->content) ?></textarea> + <br> + <button>Skicka!</button> +</form> |
