如果未指定任何操作,表单将提交到哪里? [英] Where does the form submit to if there is no action specified?

查看:63
本文介绍了如果未指定任何操作,表单将提交到哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是令我困惑的表格

<h1>
    Login
</h1>
<form action="" method="post">
    <table align="left" border="0" cellspacing="0" cellpadding="3">
        <tr>
            <td>
                Username:
            </td>
            <td>
                <input type="text" name="user" maxlength="30">
            </td>
        </tr>
        <tr>
            <td>
                Password:
            </td>
            <td>
                <input type="password" name="pass" maxlength="30">
            </td>
        </tr>
        <tr>
            <td colspan="2" align="left">
                <input type="checkbox" name="remember">
                <font size="2">
                    Remember me next time
            </td>
        </tr>
        <tr>
            <td colspan="2" align="right">
                <input type="submit" name="sublogin" value="Login">
            </td>
        </tr>
        <tr>
            <td colspan="2" align="left">
                <a href="register.php">Join</a>
            </td>
        </tr>
    </table>
</form>

我从此教程中获取了代码,它可以正常工作,但我似乎无法理解/如果不采取任何措施,表格也要提交

I got the code from this tutorial and it works fine but i cant seem to understand where a/the form submit too if no action is present

推荐答案

如果action设置为""或缺少action属性,则表单将提交给自己.也就是说,如果您的脚本是index.php,则您的表单将提交到index.php.

If action is set to "" or if the action attribute is missing, the form submits to itself. That is, if your script is index.php, your form submits to index.php.

这篇关于如果未指定任何操作,表单将提交到哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆