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? Quote 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']); ?> Quote 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? Quote 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> Quote 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. Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.