fixed edit note
This commit is contained in:
parent
5eb3e30114
commit
fc17a1a312
@ -71,7 +71,12 @@ class NotesController
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
// Process form submission
|
||||
$noteId = $_GET['id'];
|
||||
$note = $this->notesModel->editNote($noteId, $_POST['title'], $_POST['content'], $_SESSION['user_id']);
|
||||
$note = $this->notesModel->editNote(
|
||||
$noteId,
|
||||
$_POST['title'],
|
||||
$_POST['content'],
|
||||
$_SESSION['user_id']
|
||||
);
|
||||
|
||||
if ($note) {
|
||||
// Redirect to show notes page after successful creation
|
||||
|
@ -76,7 +76,7 @@ class NotesModel extends Database
|
||||
}
|
||||
}
|
||||
|
||||
function editNote($noteId, $userId, $title, $content) {
|
||||
function editNote($noteId, $title, $content, $userId) {
|
||||
$pdo = $this->linkDB();
|
||||
if (!$pdo) return ['success' => false, 'message' => 'Database error.'];
|
||||
if (empty(trim($title))) return ['success' => false, 'message' => 'Title is required.'];
|
||||
|
Loading…
x
Reference in New Issue
Block a user