表格发送数据2次

时间:2015-12-30 10:29:25

标签: php html mysql forms

我尝试在数据库中记录数据,但数据库写入空白参数。表格已发送至:site.com/inc/go.php?login=sdfdsf&pass=sddfffds**&login=&pass=**。为什么来自表单的数据发送2次?

<form id="x" action="/inc/go.php" method=POST">
    <div>
        <span>
            <label for="loginss">
               Login<span class="tcs-form-field-requared">*</span>
            </label>
        </span>

        <span>
            <input type="text" form="x" name="login" id="login" accesskey="n" tabindex="1" id="loginx" title="login" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false">
        </span>
    </div>

    <div>
        <span>
            <label for="passs" class="tcs-form-label">
                password<span>*</span>
            </label>
        </span>

        <span>
            <input class="form-element-hidden form-mobile-hidden" class="form-element-hidden form-mobile-hidden">
            <input form="x" type="password" name="pass" id="pass" accesskey="p" tabindex="2" id="passx" title="pass" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false">
        </span>
    </div>

    <div>
        <div>
            <span>lost pass?</span>
        </div>
        <div>
            <input form="x" class="button" type="submit" tabindex="3" value="log in">
        </div>
    </div>
</form>

PHP操作文件:

<?php

    include('connect.php');

    mysql_query("INSERT INTO `u825237248_gold` (login , pass) VALUES ('".$_POST['login']."','".$_POST['pass']."')",$db);

?>

1 个答案:

答案 0 :(得分:2)

<form id="x" action="/inc/go.php" method=POST">
change <form id="x" action="/inc/go.php" method="POST">