mrt003003 Posted May 30, 2011 Share Posted May 30, 2011 Hi there i was wondering if its possible to have a count down timer (for say 5 mins) that when it reaches 0 a form is updated.. <?php // set countdown timer for 5 mins $countdown = '300' if ($countdown == '0'){ update the form somehow? }?> <form id="form1" name="form1" method="POST" action="<?php echo $editFormAction; ?>"> <input name="hiddenField" type="hidden" value="<?php echo $row_query['somedata']; ?>" /> <input type="submit" name="Submit" value="Submit" /> </form> I'm a bit of a noob so any help would be ace. Thanks Link to comment https://forums.phpfreaks.com/topic/237927-update-form-on-countdown/ Share on other sites More sharing options...
plznty Posted May 30, 2011 Share Posted May 30, 2011 Like a page refresh? If so use headers. Else explain Link to comment https://forums.phpfreaks.com/topic/237927-update-form-on-countdown/#findComment-1222618 Share on other sites More sharing options...
mrt003003 Posted May 30, 2011 Author Share Posted May 30, 2011 No i was thinking more like, at the end of the countdown timer something would replace the function of the submit button and so no submit button would be needed. Thanks Link to comment https://forums.phpfreaks.com/topic/237927-update-form-on-countdown/#findComment-1222622 Share on other sites More sharing options...
plznty Posted May 30, 2011 Share Posted May 30, 2011 That would probably require AJAX, PHP is a server-side language. Link to comment https://forums.phpfreaks.com/topic/237927-update-form-on-countdown/#findComment-1222623 Share on other sites More sharing options...
mrt003003 Posted May 30, 2011 Author Share Posted May 30, 2011 Hmm is there no way to do it in php alone? Something like: $countdown = '300' if ($countdown == '0'){ if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) { $updateSQL = sprintf("UPDATE table SET something = '1'"); mysql_select_db($database_swb, $swb); $Result1 = mysql_query($updateSQL, $swb) or die(mysql_error()); }?> Thanks Link to comment https://forums.phpfreaks.com/topic/237927-update-form-on-countdown/#findComment-1222633 Share on other sites More sharing options...
plznty Posted May 31, 2011 Share Posted May 31, 2011 No, PHP is server side. Link to comment https://forums.phpfreaks.com/topic/237927-update-form-on-countdown/#findComment-1222651 Share on other sites More sharing options...
mrt003003 Posted May 31, 2011 Author Share Posted May 31, 2011 Do you know of any tutorials with ajax that can help me please?? THanks Link to comment https://forums.phpfreaks.com/topic/237927-update-form-on-countdown/#findComment-1222971 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.