HTML按钮重定向到页面并选择一个复选框形式?

问题描述 投票:0回答:1

我正在为一家酒店创建一个网站,我正在尝试为您可以预订的每个房屋创建一个按钮,而对于每个房屋,则为一个按钮,这将打开预订页面。我的问题是,如何执行该按钮将我重定向到页面并选中房屋复选框。例如,我单击G-house的div中的按钮,它选择了G-house的复选框。

HTML页面中按钮所在的部分:

                        <img src="pics/csecsilak_01.jpg" alt="">
                        <div class="nyaralok-text-content">
                            <h2>G épület</h2>
                            <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
                            <button type=button">Book</button>
                        </div>

以及预订页面表格的一部分:

                        <label class="main-label" for="nyaralo">Nyaraló:</label>
                        <div class="g-epulet-checkbox">
                            <span class="checkmark"></span>
                            <input class="checkbox-custom" type="checkbox" name="g-epulet" value="g-epulet">
                            <label>G épület</label>
                        </div>
                        <div class="e-epulet-checkbox">
                            <span class="checkmark"></span>
                            <input class="checkbox-custom" type="checkbox" id="e-epulet" name="e-epulet" value="e-epulet">
                            <label>E épület</label>
                        </div>
                        <div class="v-epulet-checkbox">
                            <span class="checkmark"></span>
                            <input class="checkbox-custom" type="checkbox" id="v-epulet" name="v-epulet" value="v-epulet">
                            <label>V épület</label>
                        </div>
                    </div>

感谢任何人能帮助我。

html forms button
1个回答
0
投票

迟早您将不得不使用JavaScript或服务器端编程。在这种情况下,最简单的解决方案可能是将HTTP GET参数附加到URL(例如?type=x&param=y),该参数由HTML formmethod="GET"自动完成。然后使用PHP生成其他形式,或通过JavaScript选中该框。后者可能是更可取的。

© www.soinside.com 2019 - 2024. All rights reserved.