[英]Redirect to the page where user came from
我有一个带表单的自定义页面模板。 此表单使用短代码显示在许多页面中。 当用户单击提交按钮时,用户将重定向到“谢谢”页面。 这个感谢页面是一个带有a href
的静态(使用WP页面编辑器创建)。 现在,当用户点击a href
(在感谢页面中找到时,他/她将重定向到用户提交表单的页面URL,但是在用户来自的页面的特定部分。但我不知道我知道怎么做。有人可以帮我这个吗?
<form method="POST">
<span class="icon-pp-green-ribbon"></span>
<fieldset>
<div class="form-group">
<label for="customer_fname"><span class="icons-asterisk"></span> Your name:</label>
<input type="text" name="name_first" placeholder="" required/>
</div>
<div class="form-group">
<label for="customer_tsname"><span class="icons-asterisk"></span> Your surname:</label>
<input type="text" name="name_last" placeholder="" required/>
</div>
<div class="form-group">
<label for="email">Your e-mail:</label>
<input type="email" name="email" placeholder="@"/>
</div>
<div class="form-group">
<label for="phone"><span class="icons-asterisk"></span> Phone number:</label>
<input type="text" name="phone" pattern ="^09\d{9}$" onkeypress="return isNumberKey(event)" size="11" placeholder="09" required/>
</div>
<div style="margin-top: 1.50em;">
<input type="checkbox" id="utm_checked" checked style=" float: left; transform: scale(1.2);"/>
<label for="utm_checked">I want to be occasionally notified</label>
</div>
<div class="form-group">
<input type="submit" name="submit" value="Send"/>
</div>
</div>
</form>
尝试使用此代码来利用浏览器维护的页面访问历史记录:
<button onclick="goBack()">Go Back</button>
<script>
function goBack() {
window.history.back();
}
</script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.