svgmx5 Posted December 29, 2010 Share Posted December 29, 2010 quick questions.. i have this code echo '<p>message of error</p>'; echo"<script type='text/javascript'> window.location='index.php'</script>"; and i want to know how could i delay the redirect to index.php for about 5 seconds or so? i've found how to do it using header(); but I've used that before and have gotten alot of errors, which is why i use on javascript to do it for me. Link to comment https://forums.phpfreaks.com/topic/222929-how-to-delay-a-php-redirect-with-this-code/ Share on other sites More sharing options...
lastkarrde Posted December 29, 2010 Share Posted December 29, 2010 Use Javascript's timing functions combined with window.location = 'index.php'; Link to comment https://forums.phpfreaks.com/topic/222929-how-to-delay-a-php-redirect-with-this-code/#findComment-1152680 Share on other sites More sharing options...
Zurev Posted December 29, 2010 Share Posted December 29, 2010 You could also use php's sleep function, in case the end user has javascript disabled. Link to comment https://forums.phpfreaks.com/topic/222929-how-to-delay-a-php-redirect-with-this-code/#findComment-1152696 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.