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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.