С Джумлой никогда не работал- тогда сначала поработай а потом берись.
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>...</title>
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
</head>
<body>
<div class="container">
<h1>Мои заметки:</h1>
<form action="add.php" method="post">
<input type="text" name="task" id="task" placeholder="..." class="form-control">
<button type="submit" name="sendTask" class="btn btn-success">+</button>
</form>
<?php
require 'configDB.php';
echo '<ul>';
$query=$pdo->query('SELECT * FROM tasks ORDER BY id DESC');
while ($row=$query->fetch(PDO::FETCH_OBJ))
{
echo '<li>'.$row->task.' <a href="delete.php?id='.$row->id.'" class="del">Удалить</a></li>';
}
echo '<ul>';
?>
</div>
</body>
</html>
<?php
$task=$_POST['task'];
if($task=='')
{
echo 'Введите текст';
exit();
}
$dsn='mysql:host=localhost;dbname=Имя-базы-данных';
$pdo=new PDO($dsn, 'Имя-юзера-БД', 'Пароль');
$sql='INSERT INTO tasks(task) VALUES (:task)';
$query=$pdo->prepare($sql);
$query->execute(['task'=>$task]);
header ('Location:/todo');
?>
<?php
$dsn='mysql:host=localhost;dbname=Имя-базы';
$pdo=new PDO($dsn, 'Имя-юзера-БД', 'Пароль');
?>
<?php
require 'configDB.php';
$id=$_GET['id'];
if (isset($id)){
$sql="DELETE FROM tasks WHERE id = ?";
$query=$pdo->prepare($sql);
$query->execute([$id]);
header("Location:index.php");
}
else
{
header("Location:index.php");
}
?>
#task {
float: left;
width: 85%;
margin-right: 5px;
}
li {
border-bottom: 1px solid #ccc;
padding: 10px;
}
.del {
float:right;
}
class Base
{
protected $uid;
public function __construct($session_uid)
{
$this->uid = $session_uid;
}
public function setUid($session_uid)
{
$this->uid = $session_uid;
}
}
class App extends Base
{
public function getUid()
{
parent::__construct(5);
return $this->uid;
}
}