Retiens le précédent nom d'un visiteur non connecté

This commit is contained in:
2022-12-11 12:04:07 +01:00
parent c2412de95a
commit 82254c2f79
2 changed files with 2 additions and 1 deletions

View File

@@ -53,6 +53,7 @@ class VisitorController {
if ($author !== null) {
$comment->setAuthor($author);
} else {
$_SESSION['previous_name'] = $_POST['name'];
$comment->setAuthorName($_POST['name']);
}
$di->getCommentGateway()->insert($comment);

View File

@@ -39,7 +39,7 @@ $title = $news->getTitle();
<div class="field">
<label class="label" for="name">Name</label>
<div class="control">
<input class="input" id="name" name="name">
<input class="input" id="name" name="name" value="<?= $_SESSION['previous_name'] ?? '' ?>">
</div>
</div>
<?php endif; ?>