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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.