webguync Posted July 9, 2009 Share Posted July 9, 2009 I have a page displaying data from a MySQL data. I wanted to create a button that would function like the F5 key on a keyboard when pressed and refresh the data, but haven't found a solution. I tried JS already. Is there a PHP solution for this? Link to comment https://forums.phpfreaks.com/topic/165398-php-solution-to-refresh-html-table-display-of-mysql-data/ Share on other sites More sharing options...
ignace Posted July 9, 2009 Share Posted July 9, 2009 This should work: <button onclick="window.location.href=window.location.href">Do Not Press</button> As would this: <?php header('Location: '. $_SERVER['REQUEST_URI']); ?> Link to comment https://forums.phpfreaks.com/topic/165398-php-solution-to-refresh-html-table-display-of-mysql-data/#findComment-872301 Share on other sites More sharing options...
webguync Posted July 9, 2009 Author Share Posted July 9, 2009 how could I get the php solution to work with a button click? Link to comment https://forums.phpfreaks.com/topic/165398-php-solution-to-refresh-html-table-display-of-mysql-data/#findComment-872316 Share on other sites More sharing options...
J.Daniels Posted July 9, 2009 Share Posted July 9, 2009 PHP is a server side language, so it cannot modify anything after the page has been loaded. If you do not want to use javascript, there are probably a few ways: Using a form: <form action="<?php echo $_SERVER['PHP_SELF']?>" method="post"> <input type="button"> </form> Using a link and styling it to look like a button: <a href="<?php echo $_SERVER['PHP_SELF']?>">Refresh</a> Link to comment https://forums.phpfreaks.com/topic/165398-php-solution-to-refresh-html-table-display-of-mysql-data/#findComment-872325 Share on other sites More sharing options...
webguync Posted July 10, 2009 Author Share Posted July 10, 2009 thanks, very much. Link to comment https://forums.phpfreaks.com/topic/165398-php-solution-to-refresh-html-table-display-of-mysql-data/#findComment-872777 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.