Php 文本框在长时间的键入过程中会忘记文本
嗨,伙计们,我有一个文本框,当我提交文本框中的任何内容时,它都倾向于提交,没有任何问题 问题是,当我提交文本框时,如果文本框中的文本需要15分钟才能输入,那么一旦提交,它就会说文本框是空的,但是如果我返回,复制粘贴我写的文本并重新提交,它就会提交 我该如何使文本被记住,以便任何人在输入博客lets say或类似内容时花一点时间输入,仍然可以毫无问题地提交内容 这是我的表格:Php 文本框在长时间的键入过程中会忘记文本,php,Php,嗨,伙计们,我有一个文本框,当我提交文本框中的任何内容时,它都倾向于提交,没有任何问题 问题是,当我提交文本框时,如果文本框中的文本需要15分钟才能输入,那么一旦提交,它就会说文本框是空的,但是如果我返回,复制粘贴我写的文本并重新提交,它就会提交 我该如何使文本被记住,以便任何人在输入博客lets say或类似内容时花一点时间输入,仍然可以毫无问题地提交内容 这是我的表格: <form method=POST action=http://www.//.com/hottopix.ph
<form method=POST action=http://www.//.com/hottopix.php?action=topicpost&who=$messageboard[id]>
<input type='hidden' name='token' value=";
echo $_SESSION[token];
echo " />
<div align=center>
<table border=0 width=66% cellspacing=0 cellpadding=0>
<tr>
<td width=18> </td>
<td>
<table border=0 width=881 cellspacing=0 cellpadding=0>
<tr>
<td bgcolor=#008000 width=881>
<table border=0 width=100% cellspacing=0 cellpadding=0>
<tr>
<td height=2 width=4></td>
<td height=2></td>
</tr>
<tr>
<td width=4></td>
<td><b><font size=2>Topic Title</font></b>
<input type=text name='topic' size=103 maxlength=250 style='outline: none; overflow: hidden; border: none'></td>
</tr>
<tr>
<td height=2 width=4></td>
<td height=2></td>
</tr>
</table>
</td>
</tr>
<tr>
<td bgcolor=#C0C0C0 width=881>
<table border=0 width=881 cellspacing=0 cellpadding=0>
<tr>
<td width=5></td>
<td width=10></td>
<td width=881><b><font size=2>Article</font></b></td>
<td width=10> </td>
</tr>
<tr>
<td width=5></td>
<td width=881>
</td>
<td width=881>
<table border=0 width=87% cellspacing=0 cellpadding=0>
<tr>
<td> </td>
<td>
<p align=center>
<textarea type=text name='topiccontent' cols=107 rows=21 style='outline: none; overflow: hidden; border: none'></textarea></td>
<td width=4> </td>
</tr>
</table>
</td>
<td width=881>
</td>
</tr>
<tr>
<td width=5></td>
<td width=10></td>
<td width=881>
<p align=right>
<input type=image name=submit0 src=http://www.//.com/commentpost2.jpg value=send border=0 ></td>
<td width=10></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td width=4> </td>
</tr>
</table>
</div>
</form>
题目
文章
这是我上面的文本框表单。以下是提交时的代码。万一有人想知道,会话令牌是没有双重张贴,这是非常好的工作
if ($_POST['topiccontent'] == "") {
echo "<p align=center>Sorry your Topic was not posted due to the Article section being blank. You will be redirected in a few seconds so please try again</p>
include("bottom.php");
exit;
}
if ($_POST['topic'] == "") {
echo "<p align=center>Sorry your Topic was not posted due to the Topic Title being blank. You will be redirected in a few seconds so please try again</p>
include("bottom.php");
exit;
}
if (isset($_SESSION['token']))
{
if (isset($_POST['token']))
{
if ($_POST['token'] != $_SESSION['token'])
{
echo "<p align=center><b>Bit of a problem here, Double Post attempt has been found. Don't worry we stopped it.</b></p>";
}
else
{
$forumcount = $row[forum] + 1;
$forumweek = $row[forumweek] + 1;
$con=mysqli_connect(connection stuff here)
if (mysqli_connect_errno())
{
echo "<p align=center>Failed to connect to MySQL: </p>" . mysqli_connect_error();
}
$sql="INSERT INTO forumtopic (topic, content, category, userid, username, date)
VALUES
('$_POST[topic]', '$_POST[topiccontent]', '$who', '$row[id]', '$row[name]', '$today')" or die(mysql_error());
if (!mysqli_query($con,$sql))
{
die('Error: ' . mysqli_error($con));
}
if($\u POST['topiccontent']==“”){
echo“很抱歉,由于文章部分为空,您的主题未发布。您将在几秒钟后被重定向,请重试
包括(“bottom.php”);
出口
}
如果($_POST['topic']==“”){
echo“很抱歉,由于主题标题为空,您的主题未发布。您将在几秒钟后被重定向,请重试
包括(“bottom.php”);
出口
}
如果(isset($\u会话['token']))
{
如果(isset($_POST['token']))
{
如果($\u POST['token']!=$\u会话['token'])
{
echo“这里有点问题,已经发现有人试图双贴。别担心,我们已经停止了它。
”;
}
其他的
{
$forumcount=$row[论坛]+1;
$forumweek=$row[forumweek]+1;
$con=mysqli\u connect(此处为连接内容)
if(mysqli\u connect\u errno())
{
echo“无法连接到MySQL:
”。mysqli_connect_error();
}
$sql=“插入forumtopic(主题、内容、类别、用户ID、用户名、日期)
价值观
(“$\u POST[topic]”、“$\u POST[topiccontent]”、“$who]”、“$row[id]”、“$row[name]”、“$today”)或die(mysql_error());
如果(!mysqli_query($con,$sql))
{
die('Error:'.mysqli_Error($con));
}
所以我们在这里没有任何问题,它只是停在我的声明,如果内容是空的,错误消息显示
就像我说的,如果你在几秒钟内键入其他内容,它不会这样做,但是如果你花时间写出像这篇文章这样的文章,它会说文本框是空的,尽管将你键入的内容复制并粘贴回文本框并重新提交会很好
那么,为什么它在文本框数据上超时?如何阻止这种情况发生?会话超时?您可能正在经历会话超时。请检查此页面:如果您打开了关于会话令牌,则不应该超时,因为会话令牌定义为
$\u session['Token']=md5(session\u id().time())
这只是为了让我们知道是否存在双重post。这可能是因为我们可以看到我的ECHO$\u会话[TOKEN]被简要介绍了一下,但稍后在下一个语句中,它被称为是$\u会话['TOKEN'],这可能是冲突和停止数据传输的原因吗?