Html 按钮将表单数据提交到另一个包含#
这是我的HTML:Html 按钮将表单数据提交到另一个包含#,html,Html,这是我的HTML: <form action="http://example.com/rezervari/index.html#/hotelbooking" method="get"> <input type="hidden" name="hotel" value="<?= $hotel ?>" class="form-control"&
<form action="http://example.com/rezervari/index.html#/hotelbooking" method="get">
<input type="hidden" name="hotel" value="<?= $hotel ?>" class="form-control">
<input type="hidden" name="roomtypegroups" value="<?= $roomtypegroups ?>" class="form-control">
<div class="form-row">
<div class="col">
<div class="form-group">
<label>Sosire</label>
<div class="input-group mb-3">
<input id="from" type="text" name="from" value="<?= $arrival == 'CURRENT' ? date('Y-m-d') : $arrival ?>" class="form-control datepicker1">
<div class="input-group-append datepicker1-h">
<span class="input-group-text" id="basic-addon2"><i class="fa fa-calendar-check-o" aria-hidden="true"></i></span>
</div>
</div>
</div>
</div>
<div class="col">
<div class="form-group">
<label>Plecare</label>
<div class="input-group mb-3">
<input id="to" type="text" name="to" value="<?= $arrival == 'CURRENT' ? date('Y-m-d', strtotime(date('Y-m-d') . ' ' . $departure . ' day')) : date('Y-m-d', strtotime($arrival . ' ' . $departure . ' day')) ?>" class="form-control datepicker2">
<div class="input-group-append datepicker2-h">
<span class="input-group-text" id="basic-addon2"><i class="fa fa-calendar-times-o" aria-hidden="true"></i></span>
</div>
</div>
</div>
</div>
</div>
片段ID应该链接到网页的特定部分,并在客户端解析
因此,它们必须跟随查询字符串
提交GET方法表单时,它将用新生成的查询字符串替换操作中查询字符串开始后的所有内容
如果您有某种从客户端读取片段ID的黑客,并且需要将查询字符串放入片段ID中,以便代码可以读取它,那么您不能使用标准表单提交逻辑
您需要使用JavaScript向表单中添加submit
事件处理程序,阻止默认操作,自己构建URL,然后导航到它(例如,通过将其分配到位置
)。您需要使用JavaScript。#
后面的所有内容都是片段,用于查询字符串。感谢您的回复。如果你有时间,也许你可以推荐javascript部分,因为我是JS的新手。谢谢:)我应该写下我所做的:这是我提交按钮的代码。