简体   繁体   English

表单提交后刷新页面

[英]Refresh the page after form submit

I have a button that extracts data to csv file. 我有一个将数据提取到csv文件的按钮。 At the same time, after it extracts the table datas to csv file, it executes a query that TRUNCATES the data in the table. 同时,将表数据提取到csv文件后,它执行查询以截断表中的数据。 The thing is, the datas in that table is echoed in a . 问题是,该表中的数据在中回显。 That's why I need to refresh the page so that the datas in the will reset. 这就是为什么我需要刷新页面以便重置中的数据的原因。

I tried different things like: 我尝试了不同的事情,例如:

onSubmit="window.location.reload()"
onClick="history.go(0)"

But it doesn't refresh the page. 但是它不会刷新页面。 But when I use: 但是当我使用时:

header('location:redirect.php');

It did refresh, but it doesn't extract the datas to csv file anymore. 它确实刷新了,但不再将数据提取到csv文件中。 What seems to be the problem? 似乎是什么问题?

Put header("Location: index.php"); exit(); 放置header("Location: index.php"); exit(); header("Location: index.php"); exit(); after the extraction of the CSV. 提取CSV之后。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM