清除表单并重定向回索引
Clear form and redirect back to index
我有一个表单,它接受输入并将其输入到数据库中。这很好,运行得很好,只是我在清除表单时遇到了问题。在Wamp中,我只需要联系form.php,这是一个空白页。我一直在试图找到一种将用户重定向回index.php并清除表单的方法。通过四处搜索,我尝试了一些事情(可能是错误的(,包括将其放在我的php末尾:
header('Location: http://stackoverflow.com');
我还试着写一个JS函数来实现
<p><input type="submit" name="submit" value="Submit" onclick="clearForm();"></p>
js
function clearForm(){
alert("Thanks, we will be in touch shortly");
document.getElementById("contactForm").reset();
}
function clearForm(){
alert("Thanks, we will be in touch shortly");
window.location=ur_url_here;
}
当您获得重定向表单时,将自动重置
function clearForm(){
alert("Thanks, we will be in touch shortly");
window.location='http://stackoverflow.com';
}
没有必要专门清除表单,除非您使用其他元素来保存详细信息,否则当您移动到新页面时,表单将被忘记。
function clearForm() {
alert("Thanks, we will be in touch shortly");
window.location='http://stackoverflow.com';
}
相关文章:
- 通过javascript重定向html传递php变量
- JavaScript下拉菜单-点击按钮并根据所选值重定向到url
- 使用angular重定向到html页面
- 如何在chrome扩展中重定向到html页面
- 无法从jquery Mobile导航栏重定向到另一个页面
- 谷歌索引和重定向
- UI 路由器不断重定向到索引,并且不加载状态/视图
- 从一个索引.html页面重定向到 2 个网址
- 将主页重定向为shell页面,而不是angularJS中的索引页面
- 重定向至“索引.html问题”诊断树
- <一个 href=#> 重定向到索引的链接..php
- 在React中,我如何将用户重定向回状态已更改的索引
- 重定向至索引页,但未处理javascript警报
- 重定向到移动网站的每一页或只是根索引
- 从注销按钮重定向后,站点不加载索引样式
- 如何将所有地址栏请求重定向到一个索引页?并使用请求的子文件夹作为输入
- 根据用户组重定向到着陆页或主页索引
- 我可以重定向Admin吗?->索引.Aspx使用javascript
- 如果使用 jquery 进行会话检查在后台失败,如何重定向索引.php页面
- 用户关闭一个选项卡(意味着注销)的许多选项卡,这些都没有重定向到索引