текстовое поле — Как сделать Rich Text Editor, который работает с переполнением стека

Я хочу создать текстовый редактор, мне не нужно много опций. Просто выделите текст жирным шрифтом и добавьте изображение. Я хочу, потому что я делаю свой собственный блог с моей собственной системой CMS. И я хотел бы добавить изображения в мой блог.

Пока это код, он работает хорошо, но я не могу добавить изображения к своему тексту или что-то еще, кто-то может мне помочь ?:

<?php

session_start();

include_once('../includes/connection.php');

if (isset($_SESSION['logged_in'])) {
if (isset($_POST['title'], $_POST['content'])) {
$title = $_POST['title'];
$content = nl2br($_POST['content']);

if (empty($title) or empty($content)){
$error ='All fields are required!';
} else {
$query = $pdo->prepare('INSERT INTO articles (article_title, article_content, article_timestamp) VALUES (?, ?, ?)');

$query->bindValue(1, $title);
$query->bindValue(2,$content);
$query->bindValue(3, time());

$query->execute();
header('Location: index.php');
}
}?>

<html>

<head>
<title> Blog </title>
<link rel="stylesheet" href="../assets/style.css" />
</head>

<body onload="enableEditMode();">
<div class="container">
<a href="index.php" id="logo">CMS</a>
<br>

<h4>Add Article</h4>

<?php if (isset($error)) { ?>
<small style="color:#aa0000;"><?php echo $error; ?></small> <br><br>
<?php } ?>

<form action="add.php" method="post" autocomplete="off">
<input type="text" name="title" placeholder="Title " /> <br><br>
<textarea rows="15" cols="50" placeholder="Content" name="content" style="hidden"></textarea> <br> <br>
<input type="submit" value="Add Article" /> </form>

</div>
</body>

</html><?php
} else {
header('Location: index.php');
}

?>

0

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector