redirects work for create and edit

This commit is contained in:
Felix Ivo
2025-06-27 10:29:34 +02:00
parent 1a5a069844
commit 5a63cc66c5
4 changed files with 5 additions and 30 deletions

View File

@@ -17,33 +17,5 @@ class WelcomeController
if ($this->notesModel === null) {
$this->notesModel = new \ppa\Model\NotesModel();
}
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if ($_POST['action'] === 'create_note') {
$this->notesModel->createNote(
$_POST['title'],
$_POST['content'],
$_SESSION['user_id']
);
exit();
}
else if ($_POST['action'] === 'update_note') {
$this->notesModel->editNote(
$_POST['note_id'],
$_POST['title'],
$_POST['content'],
$_SESSION['user_id']
);
exit();
}
else if ($_POST['action'] === 'delete_note') {
$this->notesModel->deleteNote(
$_POST['note_id'],
$_SESSION['user_id']
);
exit();
}
header('Location: ?controller=Notes&page=showNotes&do=showNotes');
}
}
}