【问题标题】:How to make a search with variables in textboxes & url variables? [closed]如何使用文本框和 url 变量中的变量进行搜索? [关闭]
【发布时间】:2015-11-01 04:31:52
【问题描述】:

我想要以下功能:

  • 点击搜索按钮后变量停留在文本框中
  • 网址中的变量
  • 当我更改网址(编辑网址)并刷新时,将变量放入文本框并进行新搜索

我的搜索有很多页面。除了第一页,他们都使用ajax。那么如何在 url 中也放上搜索结果所在的页面呢?

<form name="search1" action="/search.php" method="post">
            <input type="hidden" name="action" value="search">
            	<div class="box">
                    <span>What:</span>
                    <input type="text" placeholder="job title, keywords or company" value="{keyword}" name="keyword" />

                    <em>job title, keywords or company</em>
                </div>
                <div class="box">
                    <span>Where:</span>
                    <input type="text" placeholder="city or postcode" value="" name="location" />
                    <em>city</em>
                </div>

                <div class="box box_submit">
                    <input type="submit" value="FIND" class="max" name="" />
                	<input type="submit" value="SEARCH" class="min" name="" />
                </div>

            </form>

搜索的 url 只显示 /search.php,我希望变量也在那里。

【问题讨论】:

    标签: php html ajax .htaccess url


    【解决方案1】:

    将您的表单 Method 更改为 Get

    <form name="search1" action="/search.php" method="Get">
    

    像这样,变量将显示在 url 希望对你有帮助

    【讨论】:

    猜你喜欢
    • 2015-01-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-04
    • 2019-11-19
    • 2012-11-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多