Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP Form - Please Wait

Status
Not open for further replies.

johnnyasterisk

IS-IT--Management
Apr 2, 2008
26
IE
I have 2 php pages:

index.php - Is a simple form that collects information

process.php - is reciving the variables from the form and is carrying out some actions to process data, send emails, send sms etc.

However it takes about 10 seconds to fully run process.php after submitting the form. The problem is some impatient users my click the submit button multiple times so I wanted to display a message saying "Please Wait your information is being processed"

Can anyone suggest how I would do this with examples. Thanks

The JA
 
some solutions:

+ submit the form via ajax and disable submission after the first
don't action the form submission on the first button press. instead store all + the data in a session var and display a splash screen. cause the splash screen to fire a server event that actions the form.

there are many more.
 
Hmmmm - i am looking for something simple - I have a basic understanding of this stuff.
 
Unfortunately, its not something PHP can do directly.
Your best and easiest bet would be to use Javascript to display a message, disable the button and submit the form in that order.


Code:
<script>
function mysubmit(){
document.getElementById('waitmessage').style.display='block';
document.getElementById('subbutton').disabled='disabled';

return true;

}
</script>

...

<div id="waitmessage" style=" width: 600px; height: 400px; border:1px solid #DDDDDD; display:none; position:absolute;">Please Wait your information is being processed...</div>
<form ... onSubmit="return mysubmit();">
...
<input type=submit ... id="subbutton">
</form>

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Behind the Web, Tips and Tricks for Web Development.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top