【问题标题】:html submit buttonhtml提交按钮
【发布时间】:2013-01-03 20:42:34
【问题描述】:

我有这个代码

  1. 文件搜索.php

<html> <head> <script src="http://code.jquery.com/jquery-1.8.3.js"></script> <script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script> <script> </script> <?php if(isset($_POST['bt_submit'])){ header('Location: accueil.php?region='); } ?> <style> body { background-image: url(../images/paper_03.png); } form { background-image: url(../images/paper_02.png); } </style> </head> <body> <form name="search" method="post" > <form name="map" style="position: relative; top:10px; left:300px; width: 400px; height: 130px;"> jjjjjjjjjjjjjjjjj </form> <form name="advanced" style="position: relative; top:10px; left:300px; width: 400px; height: 130px;" action="blabla.php"> <form name="location" style="position: relative; top:10px; left:300px; width: 300px; height: 90px;"> <div style="background-color:99FFFF"><font color="blue">Location</font></div> <table> <tr> <td>Region: </td><td ><select style="width:200px" name="region"> <option value="1">truc</option> <option value="1">truc</option> <option value="1">truc</option> </select> </td> </tr> <tr> <td>City: </td><td colspan="3"><input type="text" style="width:200px" name="city" /> </td> </tr> <tr> <td>State/Province: </td><td colspan="3"><select style="width:200px"> <option value="1">truc</option> <option value="1">truc</option> <option value="1">truc</option> </select> </td> </tr> <tr> <td>Country: </td><td colspan="3"><select style="width:200px" > <option value="1">truc</option> <option value="1">truc</option> <option value="1">truc</option> </select> </td> </tr> </table> </form> <form name="keywords" style="position: relative; top:10px; left:300px; width: 400px; height: 50px;" > <div style="background-color:99FFFF"><font color="blue">Keywords</font></div> <table> <tr> <td colspan="2">Keywords: </td><td ><input type="text" style="width:225px" name="keywords" /> </td> </tr> </table> </form> <form name="company" style="position: relative; top:10px; left:300px; width: 400px; height: 50px;" > <div style="background-color:99FFFF"><font color="blue">Company</font></div> <table> <tr> <td>Company: </td><td colspan="3"><select style="width:230px"> <option value="1">truc</option> <option value="1">truc</option> <option value="1">truc</option> </select> </td> </tr> </table> </form> <form name="job_category" style="position: relative; top:10px; left:300px; width: 400px; height: 50px;"> <div style="background-color:99FFFF"><font color="blue">Job category</font></div> <table> <tr> <td>Job category: </td><td colspan="3"><select style="width:210px"> <option value="1">truc</option> <option value="1">truc</option> <option value="1">truc</option> </select> </td> </tr> </table> </form> <form name="dates" style="position: relative; top:10px; left:300px; width: 400px; height: 50px;"> <div style="background-color:99FFFF"><font color="blue">Dates</font></div> <table> <tr> <td>Date range: </td><td colspan="3"><select style="width:225px"> <option value="1">truc</option> <option value="1">truc</option> <option value="1">truc</option> </select> </td> </tr> </table> </form> </form> <input type="submit" name="bt_submit" value="Search Now" style="position: relative; left:400px; width: 100px" /> </form> </body> </html>

这个文件包含php和html代码。界面包含两个部分:第一个是一个表单,第二个是一组必须通过按钮提交的表单 我的问题是当我单击提交按钮以验证表单时重定向不起作用并且什么也没做。所以我需要知道

  1. 为什么?
  2. 如何解决此错误?

【问题讨论】:

  • 对于一个......表单可以嵌套在这样的表单中吗?如果他们可以,那对我来说似乎是个糟糕的主意。另外,请确保提交按钮在您要提交的表单内。
  • 你将缩进设置为什么?

标签: php html button submit form-submit


【解决方案1】:

您只需要一个&lt;form&gt;。您可能希望使用 &lt;fieldset&gt; 元素将表单的各个部分组合在一起,但通过使用多个表单,它们将被完全分开处理。

【讨论】:

    【解决方案2】:
    <?php
    if(isset($_POST['bt_submit'])){
    header('Location: accueil.php?region='); 
    }
    ?>
    

    将此代码放在页面的顶部,甚至在一个 html 字母之前。当某些内容已经显示时,标题不起作用

    【讨论】:

      【解决方案3】:

      您不能有嵌套表单。另外,每个输入在您的代码中显然都是不同的形式。您必须对其进行更新以使其成为单一形式。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-03-05
        • 1970-01-01
        • 2010-10-11
        • 2013-09-07
        • 2017-05-20
        • 1970-01-01
        相关资源
        最近更新 更多