Jump to content

question about passing values


tefuzz

Recommended Posts

After doing some research on a multiple step form, I have decided to use a single page, and an output according to the step that the user is on. My question is, do the values stay in $_POST even if the page is refreshed and more values are passed through $_POST?

 

Link to comment
Share on other sites

Can you post an example?

 

Every time you submit or refresh the page, you need to catch/pass the variables.

 

ok, so if on step 1 i have a field 'name' and i validate it, and now move to step 2 the value of 'name' would be there, since the page had been reloaded only once to validate the $_POST. But would be lost after the visitor submits step 2 correct?

Link to comment
Share on other sites

Can you post an example?

 

Every time you submit or refresh the page, you need to catch/pass the variables.

 

ok, so if on step 1 i have a field 'name' and i validate it, and now move to step 2 the value of 'name' would be there, since the page had been reloaded only once to validate the $_POST. But would be lost after the visitor submits step 2 correct?

 

Yes it would be lost.  You can either store it in a session or a hidden field like meomike mentioned, to retain the values.

Link to comment
Share on other sites

 

Yes it would be lost.  You can either store it in a session or a hidden field like meomike mentioned, to retain the values.

 

I was planning on using a session, but it's a 6 part form...It's an application, so some replies i got on here were if the user took too long to complete the steps the session would be lost. I guess my best bet is to stick them all into hidden fields after validation.

Link to comment
Share on other sites

Whoever uses a session that expires before a form can be filled out is an idiot. Your session will last. Hidden fields can be tampered way easier.

 

how can I make sure the session will last long enough for the user to fill out all 6 pages of the form?

Link to comment
Share on other sites

The session.gc_maxlifetime can be set anywhere - master php.ini, .htaccess file (when php is running as an Apache module), httpd.conf (Apache only), a local php.ini (when php is running as a CGI application), or even in your script, as long as it is set before every session_start() statement.

 

The session.gc_maxlifetime setting in effect when session garbage collection runs, will determine the age of the session data files that are deleted. On a shared web server using the default session.save_path, the shortest session.gc_maxlifetime setting wins. To insure that only your session.gc_maxlifetime setting affects your session data files, you must set your session.save_path to be to a folder within your accounts folder tree.

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.