You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
478 B
19 lines
478 B
<?php
|
|
require_once "db_connect.php";
|
|
|
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|
$desc = trim($_POST["task_desc"]);
|
|
if(!empty($desc)) {
|
|
$current_time = date("Y-m-d H:i:s");
|
|
$query = $pdo->prepare("INSERT INTO tasks
|
|
(task_desc, created) VALUES (:desc, :created)");
|
|
$query->execute(["desc"=>$desc,"created"=>$current_time]);
|
|
header("Location:/?status=added");
|
|
exit;
|
|
}
|
|
} else {
|
|
header("Location: /");
|
|
exit;
|
|
}
|
|
|
|
?>
|