Hi all! I have a php page which contains a form. The user enters data and then the data is processed to give some results. What I would like to have is a page inbetween, that says, for instance, "Your job is being processed" or something similar, and then, when the job is done, refresh itself to show the results. I have seen it in many websites, but I don't know what I need to get me started...
You could use a meta refresh tag... <meta http-equiv="refresh" content="5;url=http://thesite.com"> Drop that inbetween your <head> tags, and it's forward you after 5 seconds.
Exam's example is definitely the best way to do it. If you did it with Javascript you run the risk of your visitor being 'stuck' if they don't have Javascript turned on..
Hi guys, thank you for your time... I think that your idea is good, but what I need is somehow to check when the external program has ended and then redirect the user. In the way you suggested, I think that you just redirect in x seconds, but what if the program hasn't done the processing? It might take for example 1 minute or 2 or 20 seconds.. How will I know? PS: The external program writes the results to a temporary file that is being created and I read the results from it and print them to the user.
Ajax may be worth a try but it all comes down to you need something in place in case a user does not have javascript enabled
what you can also do is used the ob_start(i think) and ob_flush() methods, then when everything is finished, send through a piece of javascript that refreshes the page. echo "Loading"; flush(); ob_start(); // turn output buffering on, while output buffering is active, nothing is sent to browser // do your processing echo "<script language='javascript'>document.location='new_url';</script> // to output everything in the buffer, use ob_end_flush(); ob_end_flush(); // sned the javascirpt to refresh the page PHP: (don't mind syntax, just for quick illustration)