gibbonuk Posted August 5, 2011 Share Posted August 5, 2011 Hi, at the moment i have a form, that submits to itsself (so reloads the page but via submitting), well basicially im trying to get the submit to happen every 1 min automaticallly. How can i do this? Thanks Link to comment https://forums.phpfreaks.com/topic/243948-timer-then-submit/ Share on other sites More sharing options...
@ Posted August 5, 2011 Share Posted August 5, 2011 you will have to use javascript. look at set_interval or set_timeout to make this happen. FYI thought - having a page that refreshes every minute is gonna be annoying as hell!! A better solution would be to use ajax to process the form in the background and not refresh the page all the time. Link to comment https://forums.phpfreaks.com/topic/243948-timer-then-submit/#findComment-1252602 Share on other sites More sharing options...
WebStyles Posted August 5, 2011 Share Posted August 5, 2011 something like: <script type="text/javascript"> function timedSubmit(){ document.FORMNAME.submit(); setTimeout("timedSubmit()",1000); // 1 second } // initiate: setTimeout("timedSubmit()",3000); // 3 seconds </script> change FORMNAME to whater your <form name=""> is. Link to comment https://forums.phpfreaks.com/topic/243948-timer-then-submit/#findComment-1252609 Share on other sites More sharing options...
Maq Posted August 5, 2011 Share Posted August 5, 2011 I would agree with the AJAX suggestion, depending on what you're doing, it will be way less obtrusive. Link to comment https://forums.phpfreaks.com/topic/243948-timer-then-submit/#findComment-1252611 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.