germán m. rivera wrote:
Hi all!
Let's say I have a PHP script that needs the user to input some data during its execution. At the point the data is needed the browser could be redirected to a new page with a form where the user could enter the data. But thus is necessary to save the script state in order to continue its execution once it gets the data.
It would be preferable to mantein the execution of the script waiting for the data (in a while loop or sth similar). But, how can then the
Why keep the script running in the background? You'd just waste server time waiting for a response. What if you never received the response?
user introduce such data? With frames? One frame could execute the script, maybe outputting some information about execution and the other frame could ask for the data when needed. I think this could be done
That's reasonable You could seperate the "data" form into a seperate form and pass information if you really wanted to. Using a login for users and then passing information via $_SESSION variables would be a good way to do this. Or if you really really refuse to use sessions you could use serialize() and unserialize().
http://www.php.net/serialize http://www.php.net/unserialize
inserting JavaScript tags in the output of the script and flushing them to the browser in order to redirect the other frame to a form page. Is this valid? Do all browsers execute JavaScript commands before the page is completely charged?
No. PHP runs server side and can't wait on client side JavaScript execution. Besides, some people don't use JavaScript at all so if this is something that is required input then some people just won't see it.
Please, tell me if anyone has solved this problem in any other (maybe better) way.
Use a login mechanism, go to the data form, save the data into the session, and then retreive the session data on the other page.
Thanks, Regards, Germán
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php