不带问号的GET请求


GET request without the question mark

我是一名客服助理,我想制作一个简单的表格来检查网页上的产品价格,而不必加载整个主页。

网站为www.homebase.co.uk,搜索URL为http://www.homebase.co.uk/en/homebaseuk/searchterm/.

我想制作一个表格,它将在/searchterm/之后添加在表格中输入的文本,而不带问号。

EG如果我键入775199并按提交/搜索,它将导航到http://www.homebase.co.uk/en/homebaseuk/searchterm/775199.

非常感谢大家的帮助:)

我真的很感激!

假设您使用的是PHP。我想你想做的是:

<?php
    //THIS IS THE SAME PAGE WHERE YOUR SEARCH FORM EXISTS
    $searchPage = "http://www.homebase.co.uk/en/homebaseuk/searchterm/";
    $formAction = "./";    //FORM IS SUBMITTED BACK TO ITSELF...
    if(isset($_POST['search_term']){
        //BUILD THE REDIRECTION LINK BASED ON THE DEFAULT SEARCH PAGE: $searchPage . $_POST['search_term'])
        //AND THEN REDIRECT TO THE REDIRECTION LINK 
        header("location: " . $searchPage . htmlspecialchars(trim($_POST['search_term'])) );
        exit;
    }    

您的HTML表单可能看起来像这样:

<form method="POST" action="<?php echo $formAction; ?>" >
    <input type="text" name="search_term" id="search_term" value="" class="search_term" />
    <input type="submit" name"submit" id="submit" class="submit" value="Search" />
</form>

好的,所以我解决了问题:

<style type="text/css">
.biga {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 36px;
    color: #F90;
    background-color: #FFF;
    border: medium solid #000;
}
}
.centerpoint {
    text-align: center;
}
</style>
<title>Product Search</title>
<p>
<div class="centerpoint"> <span class="centerpoint">
<input name="prog_site" type="text" class="biga" id="prog_site" value="" />
  <a href="http://"
    onclick="this.href=(
                       'http://www.homebase.co.uk/en/homebaseuk/searchterm/' + document.getElementById('prog_site').value)"
    target="_blank">
  <input name="so_link" type="button" class="biga" value="Search Product">
  </a>
  </p>
  </span></div>

这是我使用的代码。谢谢你的帮助!