akhilkumar332 Posted December 13, 2016 Share Posted December 13, 2016 As of now when i refresh...then only the "quote" changes..... but it i want "quotes" to change automatically on its own...m new at this..plz help!!! <?php $quotes[] = "quote1"; $quotes[] = "quote2"; $quotes[] = "quote3"; $quotes[] = "quote4"; srand ((double) microtime() * 1000000); $randomquote = rand(0,count($quotes)-1); echo "<p>" . $quotes[$randomquote] . "</p>"; ?> Thank you Quote Link to comment https://forums.phpfreaks.com/topic/302728-auto-change-of-quotesin-php-urgent-help/ Share on other sites More sharing options...
cyberRobot Posted December 13, 2016 Share Posted December 13, 2016 If you want the quotes to change without the page refreshing, you need to use a client-side language, like JavaScript. Quote Link to comment https://forums.phpfreaks.com/topic/302728-auto-change-of-quotesin-php-urgent-help/#findComment-1540283 Share on other sites More sharing options...
akhilkumar332 Posted December 13, 2016 Author Share Posted December 13, 2016 (edited) can u help me as i am new at this??? i managed to get these codes!!! Edited December 13, 2016 by akhilkumar332 Quote Link to comment https://forums.phpfreaks.com/topic/302728-auto-change-of-quotesin-php-urgent-help/#findComment-1540284 Share on other sites More sharing options...
cyberRobot Posted December 13, 2016 Share Posted December 13, 2016 There appear to be a number of examples when searching for "javascript change text with timer" in Google. https://www.google.com/#q=javascript%20change%20text%20with%20timer Quote Link to comment https://forums.phpfreaks.com/topic/302728-auto-change-of-quotesin-php-urgent-help/#findComment-1540285 Share on other sites More sharing options...
kicken Posted December 13, 2016 Share Posted December 13, 2016 Or even more specifically Javascript random quote. Here's basic random quote tutorial to get you started. Quote Link to comment https://forums.phpfreaks.com/topic/302728-auto-change-of-quotesin-php-urgent-help/#findComment-1540286 Share on other sites More sharing options...
akhilkumar332 Posted December 14, 2016 Author Share Posted December 14, 2016 (edited) Thank you CyberRobot and kicken Edited December 14, 2016 by akhilkumar332 Quote Link to comment https://forums.phpfreaks.com/topic/302728-auto-change-of-quotesin-php-urgent-help/#findComment-1540302 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.