Re: [PHP] uploading files | how to avoid submitting twice?

2002-02-25 Thread Krzysztof Kocjan

In JavaScript define varaible which is global for this page, name it 
like  page_submited, by default set it to false. On submit event set 
this variable to true and then from JavaScript submit form. When user 
second time will try to submit the form do nothig, just leave function 
code. Your JvaScript code is enabled durring your html page is in 
browesr so it will have to work. I suppose there isn't any other solution.

Here is simple code

script language=JavaSript
   form_submited = 0;

function submit_only_one() {
   if ( form_submited ) {
 return 1;
   } else {
 form_submited = 1;
 document.forms[ 'name_of_your_formform' ].submit();
   }
}

/script

input type=button onclick=JavaScript:submit_only_one()

I hope I didn't make any JavaScript code errors, I didn't use it for 
long time.

Good luck

Krzysztof

Andy wrote:

 Hi there,
 
 I would like to upload files using a form.
 
 Unfortunatelly it takes a while till the file is uploaded to the server.
 During this time the same page with the submit button is viewed. If the user
 clicks another time on the submit button, I get wrong records and sometimes
 the same file twice.
 
 Is there a way to redirect imediatelly to a waiting page? I tryed to
 redirect, but somehow the server is first uploading the file before
 something else happens.
 
 Thanx for any help
 
 Andy
 
 
 
 




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] uploading files | how to avoid submitting twice?

2002-02-23 Thread Andy

Hi there,

I would like to upload files using a form.

Unfortunatelly it takes a while till the file is uploaded to the server.
During this time the same page with the submit button is viewed. If the user
clicks another time on the submit button, I get wrong records and sometimes
the same file twice.

Is there a way to redirect imediatelly to a waiting page? I tryed to
redirect, but somehow the server is first uploading the file before
something else happens.

Thanx for any help

Andy



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php