文本框会在长时间键入时忘记文本

时间:2014-11-25 22:15:32

标签: php

大家好我有一个文本框,当我提交文本框中的内容时,它往往提交没有任何问题

问题是,当我提交带有文字的文本框时,让我们说15分钟输入,一旦提交就会说该框是空的但是如果我回去复制粘贴我写的文字并重新提交它将提交。

如何让文字记住,以便任何输入博客的人都可以说或类似的东西需要花费一些时间来输入,仍然可以毫无问题地提交内容?

这是我的表格:

    <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>&nbsp;</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>&nbsp;</td>
                    </tr>
                    <tr>
                        <td width=5></td>
                        <td width=881>
                        &nbsp;</td>
                        <td width=881>
                        <table border=0 width=87% cellspacing=0 cellpadding=0>
                            <tr>
                                <td>&nbsp;</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>&nbsp;</td>
                            </tr>
                        </table>
                        </td>
                        <td width=881>
                        &nbsp;</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>&nbsp;</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));
   }

所以我们在这里没有任何问题,只是在我的声明中停止,如果CONTENT为空并且显示错误消息。

就像我说的那样,如果你在几秒钟内输入别的东西就不会这样做但是如果你花点时间写一些像这篇文章那样的文章就会说文本框是空的,虽然复制并粘贴了什么您已键入文本框并重新提交它将正常工作。

那么为什么它会在文本框数据上超时呢?我该如何阻止这种情况发生?

0 个答案:

没有答案