How is this done? PHP, Javascript or both?
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...
Renegade posted this at 02:44 — 29th April 2006.
He has: 3,022 posts
Joined: Oct 2002
All you need is to define a page in the action="" part of the tag.
So, something like should do the trick. Once the user clicks on the submit button, it will jump to "processing.php" and start processing the form data.
In processing.php process the data entered in the field and return a message.
ktsirig posted this at 20:51 — 30th April 2006.
They have: 53 posts
Joined: Oct 2005
Hi, thank you for your time!
Actually, what I do is not just take user's input and print it, but i use the data which the user sends as input to an external program that I call through PHP. This program is a bit slow, so I thought of using such a page (not a very complicated one) so that the user will see a message like "Jour job is being processed", and then, when the job is done, the page will refresh and show the results or will redirect to the results page.
Renegade posted this at 07:25 — 1st May 2006.
He has: 3,022 posts
Joined: Oct 2002
Ok, well, that do you mean by an external program? Is it another PHP program or what?
ktsirig posted this at 08:35 — 1st May 2006.
They have: 53 posts
Joined: Oct 2005
no, the external program doesn't have to do with PHP at all. It is a biology package that I call through PHP using the "system" command. And, when the program stops running, I read the results from a temporary file that is being created. I just wanted to use a message for as long as the program is running, I think it's more beautiful than not having anything at all...
JeevesBond posted this at 12:04 — 1st May 2006.
He has: 3,956 posts
Joined: Jun 2002
Well the same method still applies really, form.php is submitted to processing.php (which has the nice "Processing your request..." message), processing.php GET's or POST's all the variables from form.php, does the system call to your biology package then redirects to results.php when complete.
Does that make sense?
a Padded Cell our articles site!
CptAwesome posted this at 16:14 — 4th May 2006.
He has: 370 posts
Joined: Dec 2004
The best thing to do is
formpage.html (action=processing.php)
on processing.php have an onload="window.location=complete.php"
(just make sure to have the HTML you want displayed put before the php in processing.php then when the php is complete, it should trigger the onload and do the redirect.
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.