View Full Version : using a "loading" icon with PHP on a form submit

03-01-2008, 01:19 PM
I have a form submit which does a bit of work check if URLs are good URLs or not.. sometimes the form submission takes a few seconds before an output is resulted.

I know in AJAX you can use a "loading" icon while the XHR occurs.

for a PHP form submission:


... proces URL here


are there any tricks in PHP where a 'loading' icon can be used and once the output is resulted the loading icon is replaced by the result output?

I assume this can only be done client side (javascript).. just wondering if anyone happens to know something I new that I don't. (I am using PHP v5.xx)

the game hog
03-01-2008, 10:13 PM
From what I know, there is no possible way to manipulate how fast PHP loads in the script that is executing to make a loading screen. It would have to be done, like you said, in something like Javascript. Maybe some type of function that, as the page loads, create a timer and while that timer clicks, show the load icon.

Personally, I think it's dumb to make a loading icon. People want to navigate as quick as possible, they don't need to be delayed by a screen that is purposely loading slow.