php中的网站流
我有一个表单,允许用户在页面上发表评论,但是他们必须先登录/注册,然后才能发布 如果他们犯了错误(例如回复太短),他们会在登录后被告知(“您的回复有错误”…) 但是,如果他们的回复内容丢失,我如何保存此内容,使其显示在表单中 表单页面相当简单:php中的网站流,php,login,flow,Php,Login,Flow,我有一个表单,允许用户在页面上发表评论,但是他们必须先登录/注册,然后才能发布 如果他们犯了错误(例如回复太短),他们会在登录后被告知(“您的回复有错误”…) 但是,如果他们的回复内容丢失,我如何保存此内容,使其显示在表单中 表单页面相当简单: <?php if (isset($errors['reply_header'])) echo $errors['reply_header']; ?> <form method="post" action="http://localho
<?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-->
我知道我可以在会话中保存表单的内容,但是我应该把它放在哪里?你在做什么
$\u得到
但您的表单方法是post
因此,您应该使用$\u POST
请注意,请更改您的操作,并将reply$\u GET变量也设置为一个变量
<input type="hidden" name="action" value="reply" />
注意这是否有效您应该将其保存在此行之前的会话变量中(我假设,如果用户未登录,该脚本将不会让其余代码执行)
假设将注释输入到文本区域,则可以执行以下操作:
<textarea>
<?php echo htmlspecialchars ( $_POST['text'] ); ?>
</textarea>
当然,您需要将$\u POST['text']替换为textarea的实际名称。arrrr,…对不起,这是旧版本,我还添加了POST方法
require_once FORUM_ROOT . 'register/index.php';
<textarea>
<?php echo htmlspecialchars ( $_POST['text'] ); ?>
</textarea>