drrqwokuz71031449 2019-02-13 05:33
浏览 59

将搜索网址从搜索页面传递到帖子

I need your expertise in making this possible what's currently happening is from the homepage you have a search form using the get method and it will redirect you to the search page, what im trying to do is once you pick or choose one of the result the url from the search page will be transferred from the post that you've pick,

Example: Step #1 Homepage form, Search for Manila City Step #2 it will redirect you the search page with this url+/?tex_pickup_location=manila-city > choose a post Step #3 Copy the url /?tex_pickup_location=manila-city and add it to the url of the single post

Note: im using wordpress

I tried storing the url to a variable but im not able to make it happen,

Tried to pass the variable in to the search page

<?php
    $result= $_Get['s'];
?>

Form from the homepage

 <form role="search" method="get" action="<?php echo home_url( '/' ); ?>">
       <div class="row">
         <div class="col-md-6 location-selection">
           <h5> LOCATION </h5>
           <select name="s">
             <option value="Naia 1">Naia 1 </option>
             <option value="Manila City">Manila City </option>
          </select>
          <input type="hidden" name="search-type" value="car" />
         </div>
         <div class="col-md-6 Search-home-btn">
          <button class="btn btn-shome" type="submit">Find <i class="fa fa-arrow-right"></i></button>

         </div>
      </div>
    </form> 
  • 写回答

1条回答 默认 最新

  • dqcj32855 2019-02-13 06:22
    关注

    You are using wrong php syntax for get parameter use this:

    <?php
        $result= $_GET['s'];
    ?>
    
    评论

报告相同问题?