Welcome to Dream.In.Code
Getting PHP Help is Easy!

Join 107,696 PHP Programmers for FREE! Ask your question and get quick answers from experts. There are 1,091 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



Duration of a POST

 
Reply to this topicStart new topic

Duration of a POST

Akelo
post 2 Jul, 2008 - 08:16 AM
Post #1


D.I.C Head

**
Joined: 12 Dec, 2007
Posts: 67


My Contributions


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 smile.gif
User is offlineProfile CardPM

Go to the top of the page


Dancia
post 2 Jul, 2008 - 08:43 AM
Post #2


D.I.C Head

**
Joined: 15 Jun, 2008
Posts: 53



Thanked 1 times
My Contributions


$_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 biggrin.gif. maybe im not correct satisfied.gif
User is offlineProfile CardPM

Go to the top of the page

Moonbat
post 2 Jul, 2008 - 08:51 AM
Post #3


D.I.C Head

Group Icon
Joined: 30 Jun, 2008
Posts: 121



Thanked 7 times

Dream Kudos: 425
My Contributions


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).
User is offlineProfile CardPM

Go to the top of the page

akozlik
post 2 Jul, 2008 - 11:04 AM
Post #4


D.I.C Regular

Group Icon
Joined: 25 Feb, 2008
Posts: 395



Thanked 15 times

Dream Kudos: 700
My Contributions


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.
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 8/30/08 01:21AM

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month