Php 如何将表单提交给哈希或self

Php 如何将表单提交给哈希或self,php,html,Php,Html,我有以下表格 <form action="#!/search/" method="get" style="display:inline;" id="hdr_q"> <table cellpadding="0" cellspacing="0"> <tr><td><input id="f_peoples" name="q" class="sb_box" size="40" autocomplete="o

我有以下表格

<form action="#!/search/" method="get" style="display:inline;" id="hdr_q">                      
<table cellpadding="0" cellspacing="0">
<tr><td><input id="f_peoples" name="q" class="sb_box" size="40" autocomplete="off">
<input type="hidden" value="0" name="o">
<input type="hidden" value="all" name="st">
</td><td>&nbsp;</td><td width="20px" valign="middle">
<input type="submit" id="sfind" name="find" value="Search"></td></tr></table>
</form>

当我按下搜索按钮时,它会转到 而我想让它屈服于 该id如何设置
action=”“
。空操作将表单发送给自身

另外,您真的想同时发送submit按钮的值吗? 我建议您,取出提交按钮的
name=“find”

如果要在末尾添加&find=,请添加一个没有值的隐藏字段

<form action="" method="get" style="display:inline;" id="hdr_q">
  <table cellpadding="0" cellspacing="0">
    <tr><td><input id="f_peoples" name="q" class="sb_box" size="40" autocomplete="off">
        <input type="hidden" value="0" name="o">
        <input type="hidden" value="all" name="st">
      </td><td>&nbsp;</td><td width="20px" valign="middle">
        <input type="hidden" id="find" name="find" value=""/>
        <input type="submit" id="sfind" value="Search"></td>
    </tr>
  </table>
</form>

就表单而言,将数据“提交”到片段标识符是没有意义的,因为片段标识符永远不会发送到服务器。查询字符串始终位于片段标识符之前


如果要实现这一点,需要使用JavaScript而不是使用标准表单提交技术构建URI。大多数通用JS库都提供了将数据转换为标准编码数据的例程,这将使您在大多数情况下都能做到这一点。

您在操作中尝试过绝对url吗?noop我还没有尝试让我知道它的实际内容。.绝对URI是以协议开头的(例如)。这不会有什么帮助,因为你想保留片段标识符,而正常表单提交不会这样做。堆栈溢出太聪明了,不利于自身,它已经链接了URI(并给了它一个短标签),该URI应该启动http:…但我想#/搜索/如果我在上面,则在此处提交该问题。问题明确说明目标是提交到“/#!/search/?q=f&o=0&st=all&find=”此答案无法实现(因为
action=“
不保留片段标识符)。