当searchform动作是post时检索参数


Retrieve the parameters when searchform action is post

我有一个搜索表单。

       <form method="get" id="searchform" action="<?php bloginfo('siteurl');?>">
         <div class="search_bx1"><input type="text" class="field" name="s" id="s" placeholder="<?php esc_attr_e( 'Search', 'mclaren' ); ?>" /></div>
         <div class="search_btn1">
         <input type="image" class="submit" name="submit" id="searchsubmit" src="<?php bloginfo('template_directory'); ?>/images/search_btn.jpg" width="22" height="20" value="<?php esc_attr_e( 'Search', 'twentyeleven' ); ?>" />
        </div>
     </form>

我需要从url隐藏图像坐标。所以我想我需要改变的形式方法张贴。但是当我改变表单动作时,重定向不会发生到search.php,而是转到index.php。我该如何克服这个问题呢?请帮忙吗?

我遵循默认的搜索方法,后面跟着主题'twentyeleven'

您想要更改 method 属性,而不是action;

<form method="POST" id="searchform" action="<?php bloginfo('siteurl');?>">

一个按钮和css可以解决这个问题。

      .search_btn1{
         background:url(images/search_btn.jpg) no-repeat;
          width:20px;
         height:20px;
          border: 0;
         cursor:pointer;
       }