TheMathWizard/controllers/note-create.php
2022-12-19 20:55:48 +01:00

11 lines
No EOL
380 B
PHP

<?php
$heading = 'Create Note';
$username = 'appUser';
$password = 'password';
$config = require('config.php');
$db = new Database($config['database'], $username, $password);
if($_SERVER['REQUEST_METHOD'] === 'POST'){
$db->query("INSERT INTO notes (body, user_id) VALUES (:body, :user_id)", ['body' => $_POST['body'], 'user_id' => 1]);
}
require 'views/note-create.view.php';