PHP sessions/ page refresh???
Hello!
I am having a problem that I think is solved by using sessions and page refresh.
I have a page where the user enters data. The data are used as input for an external program that runs in the shell, irrelevant to PHP. When the program ends, all results are stored in a text file, which I open with PHP and parse the results so that the user sees them on screen.
So I have :
form.php => which contains the form
[....] => external program that runs in the background and creates temporary text file with the results
process.php => opens text file and prints the results
What I would like to do is something I have seen in many websites. I want to have an 'intermediate' page that will say for example "Please wait, we are processing your request".... This page will automatically refresh when the external program ends and then it will redirect to process.php file to show the results.
I think it is better to have such a page instead of 'stucking' to the initial page [form.php] during the processing time and then display the results.
Note that the external program can end in 1 minute, but it can last for 4 or 5 minutes if the user has submitted lots of data.
Any ideas on how to do this?
Greg K posted this at 15:32 — 31st May 2006.
He has: 2,145 posts
Joined: Nov 2003
Hav ehte external program create a second output file, that is the same as the regular output, but with a dirrecent extention.
Then have a the process.php check for that second file, which will only exist once the first file has been created. If it doesn't see the file, issue a META refresh to itself say every 20 seconds or so with a simple "processing data" screen. If the file exists, then delete that file and continue on with the normal processing you have in proces.php
-Greg
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.