HTML表单适用于桌面但不适用于移动设备

时间:2016-10-12 04:38:22

标签: php html ios mysql mobile

我有一个HTML表单,可以将一个小的20个字符的消息发送到MySQL表。它在运行Firefox 49时在我的桌面上运行得非常好,但在我朋友的Iphone 9.3.3和使用Safari浏览器的iPhone上它根本不起作用。我花了几个小时谷歌搜索试图找到问题的原因。无论如何,这是我的代码:

形成事物:

<iframe id="target-frame" name="target-frame"></iframe>
<form id="mark-form" target="target-frame" action="make_mark.php" method="post">
    You have 20 characters, use them wisely. <br>
    <input type="submit" value="Mark" onclick="timeoutMark()"></input>
    <input type="text" name="mark" maxlength="20"></input>
</form>

<script>
var timeoutMark = function timeoutMark() {
    setTimeout(markForm, 5);
}
var markForm = function markForm() {
    document.getElementById('mark-form').reset();
    location.reload();
}
</script>

make_mark.php:

include($_SERVER['DOCUMENT_ROOT']."/paths.php");
include($path['mysql']);
$mark = db_quote($_POST['mark']);
$ip = db_quote($_SERVER['REMOTE_ADDR']);
echo "<textarea>".$mark."</textarea>";

if ($mark == "''") {
    exit("Mark is empty");
}
$query = db_query("INSERT INTO marks (mark, ip) VALUES (" . $mark . "," . $ip . ")");

0 个答案:

没有答案