ユーザーがページにコメントできるフォームがありますが、投稿する前にログイン/登録する必要があります。
彼らが間違いを犯した場合 (たとえば、返信が短すぎる)、ログイン後に通知されます (「返信でエラーが発生しました」...)。
ただし、返信の内容は失われます。これを保存してフォームに表示するにはどうすればよいですか?
フォーム ページはかなり単純です。
<?php if (isset($errors['reply_header'])) echo $errors['reply_header']; ?>
<form method="post" action="http://localhost/LOGIN/user/?action=reply">
<input type="hidden" name="auth_token" value="<?php echo $auth_token; ?>">
<input type="hidden" name="thread_id" value="<?php echo $id; ?>">
<!--rest of the form goes here, thread_id shows us which thread/page they are replying to-->
これはこのページに送信されます:
# get the register/login controller:
require_once FORUM_ROOT . 'register/index.php'; // if session is not set, then ask for login
if (isset($_GET['action']) )
{
switch ($_GET['action'])
{
case 'new': # create a new thread...
require_once USER_ROOT . 'new_thread.php';
break;
case 'reply':
$_POST['action'] == 'Reply';
require_once USER_ROOT . 'thread_reply.php';
die();
break;
default: # show user page...
require_once USER_ROOT . 'main.html.php';
break;
}
}
フォームの内容をセッションに保存できることはわかっていますが、どこに保存すればよいでしょうか?