3 Replies - 1098 Views - Last Post: 02 July 2008 - 11:04 AM Rate Topic: -----

#1 Akelo  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 98
  • Joined: 12-December 07

Duration of a POST

Posted 02 July 2008 - 08:16 AM

Quick question guys, what is the duration of a $_POST['variablename']? Is it only to the next script, or does it hang around and make itself available later for other scripts. I ask this for two reasons. First, it would be kinda nice, but not necessary (with cookies or sessions it's kinda moot). Second, for security, I don't want those boys hangin' around, and if they do, how do you delete them?

Appreciate the feedback :)

Is This A Good Question/Topic? 0
  • +

Replies To: Duration of a POST

#2 Dancia  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 60
  • Joined: 15-June 08

Re: Duration of a POST

Posted 02 July 2008 - 08:43 AM

$_POST is used for posting variables from forms.
For example I've got in form name="smart", and I want to use it later.
So I use something like
$smart = $_POST['smart'];
If you click on the link $_POST and $smart will be cleaned. To fix this you can set $_POST['smart']; into session or If you using functions you can make $smart global variable(global $smart)

So answer is: $_POST is deleted after you visit something else. Its just a method for transvering variables:
$_POST - invisible in url
$_GET - visible in url
$_REQUEST - doesn't matter if looking for post or get.

Sorry Im begginer too. Thats all I know :D. maybe im not correct -.-
Was This Post Helpful? 0
  • +
  • -

#3 Moonbat  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 36
  • View blog
  • Posts: 424
  • Joined: 30-June 08

Re: Duration of a POST

Posted 02 July 2008 - 08:51 AM

POST variables only go away once you replace it with something else. If you sent POST variables to a page, then refresh that page, you'll see that the same POST variables are sent. They only go away when they are changed (or unset, I guess).
Was This Post Helpful? 0
  • +
  • -

#4 akozlik  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 90
  • View blog
  • Posts: 797
  • Joined: 25-February 08

Re: Duration of a POST

Posted 02 July 2008 - 11:04 AM

POST variables are erased as soon as you go to a different page than the one that received the post variables. This is because your POST variables are sent to the receiving page via the HTTP Headers. When you navigate to a different page those headers are replaced by the new ones. This is the same reason why you have to do all header() redirects before any output is put to the screen.

If you are using Firefox ( <3 ) you can download the Live HTTP Headers extension at:

http://livehttpheaders.mozdev.org/

This will allow you to view all the headers that are being sent by your browser.

Hmm, now I'm wanting to write a tutorial on HTTP headers. Hope that all answered your question.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1