Jump to content

Does POST array data stay until unset?


jcanker

Recommended Posts

If I set up a series of pages with <form action> that points to the next step in the application process, will I be able to refer back to $_POST[] data directly once it comes time to process the input (provided, of course that I don't use the same form element name throughout)?

 

In otherwords, if <input name='fname'> appears on the page representing the first step, can I later refer to $_POST['name'] after they click through several pages of forms?

I suppose I could set $_SESSION variables each step, but that seems tedioius for what I want to accomplish....

Link to comment
https://forums.phpfreaks.com/topic/66098-does-post-array-data-stay-until-unset/
Share on other sites

When you submit a form you submit a POST request to the webserver and the POST data is not stored through additional numbers of requests. So they are wiped as soon as you submit a new request to the server...

 

You should save them as $_SESSION variables:

 

<?php

//After submission of step1
$_SESSION['step1'] = $_POST;

//After submission of step2
$_SESSION['step2'] = $_POST;

?>

 

This will save each $_POST for you to process later on.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.