将表单发送的数据写入单个变量中

问题描述

<div id="price-range" class="search-price-filter-form">
  <form method="get" action="/search" novalidate="novalidate">
    <label for="pt"><input class="home-price-filter-inputs price-from valid" aria-label="From" type="number" id="pt" name="price" value="1" min="1" max="999999" maxlength="6" aria-invalid="false">
<em>$</em>
</label>
    <span class="form--text first">to</span>
    <label for="pf"><input class="home-price-filter-inputs price-to valid" aria-label="to" type="number" id="pf" name="price" value="300" min="1" max="999999" maxlength="6" aria-invalid="false"><em>$</em>
</label>
    <span class="form--text last">between</span>
    <button id="pricefilterbutton" type="submit">Show products</button>
  </form>

SS:https://prnt.sc/103vx43

这段代码输出链接中是这样的:

/search?price=1&price=300


我想让他输出下面的网址。

/search?price=1-300

我希望它在 price = 部分的第一个框和第二个框中写入数据,并在它们之间加上 - 符号。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)