forked from andyblarblar/assignment6cis435
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathedit_article.php
More file actions
54 lines (46 loc) · 1.34 KB
/
edit_article.php
File metadata and controls
54 lines (46 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
include('db.php');
include('function.php');
// Require id in query params
$id = $_GET["id"];
$statement = $connection->prepare(
"SELECT * FROM articles WHERE id=:id"
);
$statement->execute(array(
":id" => $id
));
// Grab article info
$article = $statement->fetchObject("ArticleDTO");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Create Article</title>
<script src="https://cdn.tiny.cloud/1/no-api-key/tinymce/6/tinymce.min.js" referrerpolicy="origin"></script>
</head>
<script>
tinymce.init({
selector: '#mytextarea'
}).then((editors) => {
for (let ed of editors) {
// Inject article text into RTE
ed.setContent('<?= $article->article_text ?>')
}
}
)
</script>
<body>
<form action="insert.php" method="post" enctype="multipart/form-data">
<!-- Discriminate add vs edit via hidden inputs-->
<input type="hidden" name="operation" value="Edit">
<input type="hidden" name="article_id" value="<?= $id ?>">
<label for="author_name">Author name:</label>
<input type="text" value="<?= $article->author_name ?>" name="author_name">
<br>
<label for="mytextarea">Article body:</label>
<input type="textarea" id="mytextarea" name="article_text">
<input type="submit" value="submit">
</form>
</body>
</html>