html 表单的问题

发布于 2024-08-04 11:57:17 字数 720 浏览 2 评论 0原文

index.php:

    <form action="update_db.php" method="post">
    <?php
        require_once 'modules/' . $currentModule . '.php';
    ?>      
    </form>  

modules/some_module.php

...
<input type="submit" />
...

update_db.php:

@extract( $_POST );
print_r( $_POST );

加载index.php后我看到需要表单。但在提交过程中我进入了同一页面(index.php)。为什么?


http://****/admin/

这是生成的 html 代码: http://dpaste.com/93396/


太奇怪了,但是表单生成了2次...我删除了所有部分代码并重写了它。现在一切都很好。谢谢大家。

index.php:

    <form action="update_db.php" method="post">
    <?php
        require_once 'modules/' . $currentModule . '.php';
    ?>      
    </form>  

modules/some_module.php

...
<input type="submit" />
...

update_db.php:

@extract( $_POST );
print_r( $_POST );

After loading index.php i see need form. But during submitting i'm coming to the same page (index.php). Why?


http:/****/admin/

Here is html-code generated: http://dpaste.com/93396/


It's so strange, but form generates 2 times... I removed all part of code and rewrited it. Now everything is fine. Thanks all.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

独夜无伴 2024-08-11 11:57:17

我看了你的网站。您的表单操作是index.php,这就是为什么您在单击“提交”后仍然看到相同的页面。如果您的上述代码正确,请确保您的模块中没有包含提交按钮的

标记。

<form action="index.php" method="post">
<table align="center">

    <tr>
        <td>Логин: </td>
        <td><input type="textfield" name="login" /></td>
    </tr>
    <tr>
        <td>Пароль: </td>
        <td><input type="password" name="password" /></td>
    </tr>

    <tr>
        <td></td>
        <td align="right"><input type="submit" name="submit" value="вход" /></td>
    </tr>
<table>
</form>

I took a look at your site. Your form action is index.php and that is why you keep seeing the same page after you click submit. If your code above is correct, ensure that you do not have <form> tags in your module containing the submit button.

<form action="index.php" method="post">
<table align="center">

    <tr>
        <td>Логин: </td>
        <td><input type="textfield" name="login" /></td>
    </tr>
    <tr>
        <td>Пароль: </td>
        <td><input type="password" name="password" /></td>
    </tr>

    <tr>
        <td></td>
        <td align="right"><input type="submit" name="submit" value="вход" /></td>
    </tr>
<table>
</form>
醉酒的小男人 2024-08-11 11:57:17

你有这个:

<form action="index.php" method="post">

不是这个:

<form action="update_db.php" method="post">

更改它,你的表单将发布到 update_db.php

you have this:

<form action="index.php" method="post">

not this:

<form action="update_db.php" method="post">

Change it and your form will post to update_db.php

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文