Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Forms SEO Url在表单提交时未更改_Forms_Url_Seo_Form Submit - Fatal编程技术网

Forms SEO Url在表单提交时未更改

Forms SEO Url在表单提交时未更改,forms,url,seo,form-submit,Forms,Url,Seo,Form Submit,我使用SEO URL加载我的页面,但我的搜索表单有问题。当我单击submit时,它不会将整个url更改为表单中指定的url,而是将变量附加到url中 我的问题是,如何用表单变量替换整个URL 这是我的表格代码: <form action="<?php $_SERVER['PHP_SELF'] ?>" method="get"> <input type="text" onfocus="if(this.value==this.defaultValue) this

我使用SEO URL加载我的页面,但我的搜索表单有问题。当我单击submit时,它不会将整个url更改为表单中指定的url,而是将变量附加到url中

我的问题是,如何用表单变量替换整个URL

这是我的表格代码:

<form action="<?php $_SERVER['PHP_SELF'] ?>" method="get">
    <input type="text" onfocus="if(this.value==this.defaultValue) this.value='';" onblur="if(this.value=='') this.value=this.defaultValue;" name="q" value="Search" /> 
    <input type="hidden" value="search" name="p" />
    <input type="submit" value="Search" class="submit" />
      </form>

好吧,我想我是用黑客破解的

显然,如果我将变量附加到动作url,这将强制浏览器加载新url,而不是将表单变量附加到现有url

例如


<form action="<?php $_SERVER['PHP_SELF'] ?>?p=search" method="get">
<input type="text" onfocus="if(this.value==this.defaultValue) this.value='';" onblur="if(this.value=='') this.value=this.defaultValue;" name="q" value="Search" /> 
<input type="hidden" value="search" name="p" />
<input type="submit" value="Search" class="submit" />
  </form>