html - Reload Page on after some php code -
I am displaying a log file from my Raspberry P (door lock / door opened).
I have the possibility to delete this logfile with a button.
and click on the same button to reload the page and display the empty logfile.
I have the code:
& lt; Form method = "get" action = "test.php" & gt; & Lt; Input type = "submit" value "test" name = "test1" & gt; & Lt; / Form & gt; & Lt ;? Php if (isset ($ _GET ['test1'])) {unlink ('test.txt'); Touch ('test.txt'); }? & Gt; This code reloads the page but does not display the empty log file (but it deletes the logfile and creates a new blank one).
What do I want now that the page should be reloaded after the PHP code, so the empty logfile is displayed immediately. I do not know at all what can I do? Any signals?
& lt ;? Php if (isset $ _GET ['test1'])) {unlink ('test.txt'); Touch ('text.txt'); Header ("Location:". $ _SERVER ['PHP_SELF']); Go out(); }? & Gt;
Comments
Post a Comment