如何向 URL 添加参数

How do I add a parameter to the URL

表单在提交时使用参数将用户发送到 URL。我想在最后的 url link 中添加一个参数。我正在使用 ACF(高级自定义字段)来显示参数。

我如何添加 <?php echo esc_url( $linkname ); ?> 以便在提交按钮时附加最后的 url link:

<form class="booking-form clearfix" action="https://app-apac.thebookingbutton.com/properties/yaangcomedirect" name="check">
Start Date : <input type="text" name="check_in_date" id="check_in_date" value="" /> 
End Date : <input type="text" name="check_out_date" id="check_out_date" value="" /> 
 <select id="prefill-8-19" class="form-control gdlr-combobox-wrapper" name="number_adults">
         <option selected="selected" value="1 Adult">1 Adult</option>
         <option value="2 Adults">2 Adult</option>
         <option value="3 Adults">3 Adult</option>
         <option value="4 Adults">4 Adult</option>
         <option value="5 Adults">5 Adult</option>
         <option value="6 Adults">6 Adult</option>
         <option value="7 Adults">7 Adult</option>
         <option value="8 Adults">8 Adult</option>
         <option value="9 Adults">9 Adult</option>
         <option value="10 Adults">10 Adult</option>
     </select>
     <select id="prefill-8-19" class="form-control gdlr-combobox-wrapper" name="number_children">
        <option selected="selected" value="0 Children">0 Children</option>
        <option value="1 Children">1 Children</option>
        <option value="2 Children">2 Children</option>
        <option value="3 Children">3 Children</option>
        <option value="4 Children">4 Children</option>
        <option value="5 Children">5 Children</option>
        <option value="6 Children">6 Children</option>
        <option value="7 Children">7 Children</option>
        <option value="8 Children">8 Children</option>
        <option value="9 Children">9 Children</option>
        <option value="10 Children">10 Children</option>
        <option value="11 Children">11 Children</option>
        <option value="12 Children">12 Children</option>
    </select>
<input name="check" type="submit" class="btn btn-default" value="Check Availability">
</form>

您可以像这样使用隐藏的输入字段进行传递:

<input type="hidden" name="linkname" value="<?php echo esc_url( $linkname ); ?>">

所以最终代码是这样的:

<form class="booking-form clearfix" action="https://app-apac.thebookingbutton.com/properties/yaangcomedirect" name="check">
Start Date : <input type="text" name="check_in_date" id="check_in_date" value="" /> 
End Date : <input type="text" name="check_out_date" id="check_out_date" value="" /> 
 <select id="prefill-8-19" class="form-control gdlr-combobox-wrapper" name="number_adults">
         <option selected="selected" value="1 Adult">1 Adult</option>
         <option value="2 Adults">2 Adult</option>
         <option value="3 Adults">3 Adult</option>
         <option value="4 Adults">4 Adult</option>
         <option value="5 Adults">5 Adult</option>
         <option value="6 Adults">6 Adult</option>
         <option value="7 Adults">7 Adult</option>
         <option value="8 Adults">8 Adult</option>
         <option value="9 Adults">9 Adult</option>
         <option value="10 Adults">10 Adult</option>
     </select>
     <select id="prefill-8-19" class="form-control gdlr-combobox-wrapper" name="number_children">
        <option selected="selected" value="0 Children">0 Children</option>
        <option value="1 Children">1 Children</option>
        <option value="2 Children">2 Children</option>
        <option value="3 Children">3 Children</option>
        <option value="4 Children">4 Children</option>
        <option value="5 Children">5 Children</option>
        <option value="6 Children">6 Children</option>
        <option value="7 Children">7 Children</option>
        <option value="8 Children">8 Children</option>
        <option value="9 Children">9 Children</option>
        <option value="10 Children">10 Children</option>
        <option value="11 Children">11 Children</option>
        <option value="12 Children">12 Children</option>
    </select>
<input name="check" type="submit" class="btn btn-default" value="Check Availability">
<input type="hidden" name="linkname" value="<?php echo esc_url( $linkname ); ?>">
</form>

未测试。