I need help handling form posting

This is a discussion on I need help handling form posting within the PHP General forums, part of the PHP Programming Forums category; Hi all: In my quest to make things seem easier for the user to understand, I'm trying to retrieve ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 11-15-2007
Jon Westcot
 
Posts: n/a
Default I need help handling form posting

Hi all:

In my quest to make things seem easier for the user to understand, I'm trying to retrieve the time that I start posting a very large file via a form post. The form action sends it back to itself, which is fine. It took me some time to figure out that NOTHING happens on the client until the form has been completely transmitted to the server. In my particular case, this can be a long time, anywhere from 15 to 30 minutes. I'd like to be able to notify the user of when the file upload actually began.

Is there a way that I can intercept the click of the "Upload" button, have it update a field (probably a hidden one) with a date/time stamp, and then have that value included in the $_POSTed values? I'm thinking (fearing, rather) that this is probably all off-topic and probably is best addressed with some type of JavaScript solution, but it's late, I'm not thinking clearly, and I've been doing data conversions all day, which is a sure-fire way to get me emulating some Romero zombies.

Any help you can spare will be greatly appreciated.

Jon

Reply With Quote
  #2 (permalink)  
Old 11-15-2007
Per Jessen
 
Posts: n/a
Default Re: [PHP] I need help handling form posting

Jon Westcot wrote:

> Is there a way that I can intercept the click of the "Upload"
> button, have it update a field (probably a hidden one) with a
> date/time stamp, and then have that value included in the $_POSTed
> values?


Sure, javascript is the answer.


/Per Jessen, Zürich
Reply With Quote
  #3 (permalink)  
Old 11-15-2007
Per Jessen
 
Posts: n/a
Default Re: [PHP] I need help handling form posting

Per Jessen wrote:

> Jon Westcot wrote:
>
>> Is there a way that I can intercept the click of the "Upload"
>> button, have it update a field (probably a hidden one) with a
>> date/time stamp, and then have that value included in the $_POSTed
>> values?

>
> Sure, javascript is the answer.
>


pseudocode:

onclick="javascript:nnnnn(this)"

update field with local timestamp
submit form.


/Per Jessen, Zürich
Reply With Quote
  #4 (permalink)  
Old 11-15-2007
Robert.Degen@rwth-aachen.de
 
Posts: n/a
Default Re: [PHP] I need help handling form posting

> Jon Westcot wrote:
>
> > Is there a way that I can intercept the click of the "Upload"
> > button, have it update a field (probably a hidden one) with a
> > date/time stamp, and then have that value included in the $_POSTed
> > values?

>
> Sure, javascript is the answer.


But don't forget to send a server timestamp within the form. Just for the case
that server time and client time may differ in some minutes (or even timezone).

So on clientside, you just ADD the amount of time between initial display and submit.

Or am I wrong?!


so far
Rob

>
>
> /Per Jessen, Zürich

Reply With Quote
  #5 (permalink)  
Old 11-15-2007
Per Jessen
 
Posts: n/a
Default Re: [PHP] I need help handling form posting

Robert.Degen@rwth-aachen.de wrote:

> But don't forget to send a server timestamp within the form. Just for
> the case that server time and client time may differ in some minutes
> (or even timezone).


The OP said "I'd like to be able to notify the user of when the file
upload actually began.", so the timestamp from the local machine is
probably the best choice.



/Per Jessen, Zürich
Reply With Quote
  #6 (permalink)  
Old 11-15-2007
Daniel Brown
 
Posts: n/a
Default Re: [PHP] I need help handling form posting

On Nov 15, 2007 12:14 PM, <admin@buskirkgraphics.com> wrote:
> FOR GODS SAKE DON'T comment on syntax or design. I DO NOT CARE this is a
> example ONLY!!!!!!!
> OF COURSE I LEFT OUT CODE. OF COURSE THIS IS NOT A COPY PASTE AND IT WILL
> RUN!!


There should be an apostrophe in "GODS" and your sentence should
read "this is an example", not "a example".

Overall: B+

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

If at first you don't succeed, stick to what you know best so that you
can make enough money to pay someone else to do it for you.
Reply With Quote
  #7 (permalink)  
Old 11-15-2007
admin@buskirkgraphics.com
 
Posts: n/a
Default RE: [PHP] I need help handling form posting

I do this

Example:
<?
switch($_REQUEST['req'])
{
default:
$click_stamp =date('is');
echo "<form action=? method=post><input type=hidden name=clicks
value=$click_stamp>
<input type=file name=upfile tabindex=1 size=35>
<input type=submit value=upload name=req></form>";
break;

case "upload":

//Upload function here

$dispay_time = date('is') - $_POST['$click_stamp'];
Echo "<CENTER>File took $dispay_time to upload";
//Time stamp it anyway you want EXAMPLE ONLY!!!!!!
break;
}
?>

FOR GODS SAKE DON'T comment on syntax or design. I DO NOT CARE this is a
example ONLY!!!!!!!
OF COURSE I LEFT OUT CODE. OF COURSE THIS IS NOT A COPY PASTE AND IT WILL
RUN!!




-----Original Message-----
From: Jon Westcot [mailto:jon@westcot.net]
Sent: Thursday, November 15, 2007 4:17 AM
To: PHP General
Subject: [php] I need help handling form posting

Hi all:

In my quest to make things seem easier for the user to understand, I'm
trying to retrieve the time that I start posting a very large file via a
form post. The form action sends it back to itself, which is fine. It took
me some time to figure out that NOTHING happens on the client until the form
has been completely transmitted to the server. In my particular case, this
can be a long time, anywhere from 15 to 30 minutes. I'd like to be able to
notify the user of when the file upload actually began.

Is there a way that I can intercept the click of the "Upload" button,
have it update a field (probably a hidden one) with a date/time stamp, and
then have that value included in the $_POSTed values? I'm thinking
(fearing, rather) that this is probably all off-topic and probably is best
addressed with some type of JavaScript solution, but it's late, I'm not
thinking clearly, and I've been doing data conversions all day, which is a
sure-fire way to get me emulating some Romero zombies.

Any help you can spare will be greatly appreciated.

Jon
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 01:23 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0