Jump to content

Delaying Parts Of A Page


cliftonbazaar

Recommended Posts

I have a page that echo's 10 questions so the user can choose one, what I want is a one second delay between each question being displayed, I have tried sleep() in the loop but this doesn't work :(

 

My current code is

for($i=0; $i < 10; $i++) {
sleep(1);
echo "<tr><td style='text-align:center;'>$i</td>
 <td colspan=9>";
 ?><input type="button" value="<?php echo $rows[$_SESSION['questions'][$i]]["question"]; ?>"
 onclick="location.href='game/update.php?gameID=<?php echo $player['current_game_id']."&gamequestion=".$rows[$_SESSION['questions'][$i]]["question_no"]."&runs=$runs"; ?>'"><?php
 echo "</td></tr>";
}

 

NOTE that if I take sleep(1) out everything works fine but when I put it in it only gives a ten second delay after I have clicked a button that appears from in the loop.

Link to comment
https://forums.phpfreaks.com/topic/268952-delaying-parts-of-a-page/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.