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

main
Clément FRÉVILLE 2 years ago
parent c2412de95a
commit 82254c2f79

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

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

Loading…
Cancel
Save