timmah1 Posted October 7, 2008 Share Posted October 7, 2008 I have a form that processes information for health insurance. It works great! But this client wants, that after you click on 'submit', it shows like an animation or words 'Processing information', then show the results. I'm not sure how to do this. I tried <? if($_POST['submit']){ echo 'Processing information. Please wait'; sleep(5); } ?> and that works great, but the 'Processing information. Please wait stays after the 5 seconds. Is there any way to make that disappear, or do you have a different solution, beside AJAX? I'm not that familiar with AJAX, and I'm afraid I'd have to re-do the entire form. Thanks in advance/ Link to comment https://forums.phpfreaks.com/topic/127471-processing-with-php/ Share on other sites More sharing options...
DarkWater Posted October 7, 2008 Share Posted October 7, 2008 Ajax would be the only way to accomplish that as smoothly as you hope for it to be... Link to comment https://forums.phpfreaks.com/topic/127471-processing-with-php/#findComment-659489 Share on other sites More sharing options...
timmah1 Posted October 7, 2008 Author Share Posted October 7, 2008 Hey DarkWater, still quoting you, lol Would there be an easy way of implementing that without re-building the form? Link to comment https://forums.phpfreaks.com/topic/127471-processing-with-php/#findComment-659491 Share on other sites More sharing options...
DarkWater Posted October 8, 2008 Share Posted October 8, 2008 It shouldn't honestly be too bad. I'd use a JS framework to set up the Ajax functionality though, instead of hacking together some solution that probably isn't optimal. I'd suggest Prototype if you just want Ajax, and script.aculo.us (an add-on to Prototype) if you want to use actual effects with the Ajax. I happen to love script.aculo.us. =P The form won't really need redesign, it's probably going to be the PHP page that needs reworking. Also, don't use short tags. =P Link to comment https://forums.phpfreaks.com/topic/127471-processing-with-php/#findComment-659494 Share on other sites More sharing options...
F1Fan Posted October 8, 2008 Share Posted October 8, 2008 I use something that is much simpler (although less dynamic, too). On the submitting page, have an onunload event in the body that displays a "Please Wait" image and/or text. Then have the same thing on the post-to page, except it is displayed by default and is removed using the onload event, again in the body. Link to comment https://forums.phpfreaks.com/topic/127471-processing-with-php/#findComment-659505 Share on other sites More sharing options...
timmah1 Posted October 8, 2008 Author Share Posted October 8, 2008 the form and the process of the form are on the same page. how could that be implemented? Link to comment https://forums.phpfreaks.com/topic/127471-processing-with-php/#findComment-659507 Share on other sites More sharing options...
F1Fan Posted October 8, 2008 Share Posted October 8, 2008 <html> <head> <script type="text/javascript"> function onlyHide(id) { document.getElementById(id).style.display = "none"; } function onlyShow(id) { document.getElementById(id).style.display = "block"; } </script> </head> <body onload="onlyHide('pleasewait');" onunload="onlyShow('pleasewait');"> <table width="100%" height="100%" cellpadding="5" id="pleasewait" style="display:block;z-index:1;position:absolute;left:0px;top:0px;"> <tr height="225"> <td width="100%" colspan="3"> </td> </tr> <tr> <td width="49%"> </td> <td align="center" valign="middle" width="2%" nowrap bgcolor="#FFFFFF" style="border: solid 1px black;"> Please wait...<br> <image src="images/pleasewait.gif"> </td> <td width="49%"> </td> </tr> </table> <!-- Add the rest of your page here --> Grab the image from this topic: http://www.phpfreaks.com/forums/index.php/topic,219292.msg1005499.html#msg1005499 Link to comment https://forums.phpfreaks.com/topic/127471-processing-with-php/#findComment-659509 Share on other sites More sharing options...
DarkWater Posted October 8, 2008 Share Posted October 8, 2008 the form and the process of the form are on the same page. how could that be implemented? Create a separate page for processing. Link to comment https://forums.phpfreaks.com/topic/127471-processing-with-php/#findComment-659513 Share on other sites More sharing options...
timmah1 Posted October 8, 2008 Author Share Posted October 8, 2008 That's perfect F1Fan. Is there anyway to set a timer within that? Link to comment https://forums.phpfreaks.com/topic/127471-processing-with-php/#findComment-659522 Share on other sites More sharing options...
F1Fan Posted October 8, 2008 Share Posted October 8, 2008 Sure. Why would you want to have a timer? All that would do is make people wait longer. Link to comment https://forums.phpfreaks.com/topic/127471-processing-with-php/#findComment-659884 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.