post variable

P

pavloutefkros

sorry for creating a new post but this is totally different from the
previous one.

Here is the problem (which is very hard to explain, so i will use a
paradigm): i submit a form and the post variable is being sent to the
page test.py. then the test.py retrieves the POST and print it to the
page. now everything is great except one thing.

lets say i submitted the form and went to test.py and the output was
correct, then, while i'm on test.py if i reload the page, the POST
variable IS STILL THERE.

so the output is always the POST retrieven at first. So the page keeps
on printing the POST variable retrieven at first even thought i might
have reloaded the page 1000 times. Is there any way to "empty" the
POST variable, so that at reload nothing would be the same?

ps: so many "so" and wacky explanation, noone would understand :(.
 
D

Diez B. Roggisch

sorry for creating a new post but this is totally different from the
previous one.

Here is the problem (which is very hard to explain, so i will use a
paradigm): i submit a form and the post variable is being sent to the
page test.py. then the test.py retrieves the POST and print it to the
page. now everything is great except one thing.

lets say i submitted the form and went to test.py and the output was
correct, then, while i'm on test.py if i reload the page, the POST
variable IS STILL THERE.

so the output is always the POST retrieven at first. So the page keeps
on printing the POST variable retrieven at first even thought i might
have reloaded the page 1000 times. Is there any way to "empty" the
POST variable, so that at reload nothing would be the same?

ps: so many "so" and wacky explanation, noone would understand :(.

If you are reloading a page, the variables that were sent to it are
re-send by the browser. I fail to see where the problem is. Reloading
means reloading.

Diez
 
H

Hrvoje Niksic

so the output is always the POST retrieven at first. So the page
keeps on printing the POST variable retrieven at first even thought
i might have reloaded the page 1000 times. Is there any way to
"empty" the POST variable, so that at reload nothing would be the
same?

Have test.py send a redirect to another page (or to itself, sans the
params). Then reloading won't resend the POST params.
 
P

pavloutefkros

1. yes i've tried that technique but its annoying, the user can easily
stop the redirection and not "elegant".

2. yes i'm aware of that, however what i've mentioned above is just an
example, it's actually way more serious.

guess i'll have to bare with it.
 
B

bruno.desthuilliers

1. yes i've tried that technique but its annoying, the user can easily
stop the redirection and not "elegant".

It's a very canonical technique with HTTP (at least after a successful
POST). But I suspect you're not doing it the right way, since you're
talking about "the user (...) stop(ing) the redirection".
"Redirecting" here means "sending an HTTP redirection status code and
the appropriate location header" (according to the rfc, code should be
303, but for legacy reasons it's often a 302). You must indeed *not*
have send *anything* else to the client before (which means that you'd
better use a log file to trace your code) !
 
G

Gabriel Genellina

En Mon, 28 Jan 2008 19:32:45 -0200, (e-mail address removed)
1. yes i've tried that technique but its annoying, the user can easily
stop the redirection and not "elegant".

2. yes i'm aware of that, however what i've mentioned above is just an
example, it's actually way more serious.

See this sequence:

User POSTs a form
Web app processes the form.
Web app updates its internal state.
Web app don't output anything, and finishes the POST handling with a
redirect (implicit GET)

Browser receives the redirect and issues a GET request
Web app returns content

The important thing is that a POST request *never* returns content, always
redirects. All content is retrieved using GET.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top