Jump to content

PHP Wait Screen


kid_drew

Recommended Posts

Does anyone know of a good way to implement a wait screen while some large query is being computed?  I can create a wait screen with a nice animated gif and all that, but I'm not sure how to do the timing.  I.e., how do you immediately go to another page after a form submit and wait at that screen until the data is ready then load the results page, or is that even possible in php?
Link to comment
Share on other sites

Don't quote me on this but I don't believe there is a PHP "pause" function.  At least not one that is easily done.

I KNOW this can be done with AJAX and I've even seen a few tutorials on the web.  I'm sure Google can help there.  If anything you can use the javascript settime() function (pretty sure that's the one) to give it (x) amount of time before refreshing the page.  Just my 2 cents!
Link to comment
Share on other sites

What about the fork() function?  Could you fork to run the query process in the background, run a do/while loop on your wait screen and redirect only when the forked process updates a session variable, or something similar?

I've never used fork, so I'm totally shooting in the dark.
Link to comment
Share on other sites

I know this isn't the "best" programming practice but a decent way to half-ass the solution would be to pop open a div when the user presses the submit button.  Basically the page will hang while the query is being performed so the <div> will stay open until the query is finished and the new page loads.

Maybe you could post to a new page that performs the query and throw a header() after the query is performed to redirect to the results.  I'm just throwing things out here = /
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.