Jump to content

[SOLVED] Hidden form elements


snow

Recommended Posts

Hi can someone simply explain how I can use hidden form elements so I can keep variables for later on.

 

For example:

 

Web Page 1 (Has the forms) --> Web Page 2 (gets $_POST) --> Web Page 3 now has lost all the post data from page 2, how do I keep it so I can re-use it?

 

I'm new at php and any help would be appreciated, preferrably simple methods!

Thanks heaps in advance!

Link to comment
https://forums.phpfreaks.com/topic/69032-solved-hidden-form-elements/
Share on other sites

use sessions

 

put:

session_start();

at the top of each page.

 

then you can pass variables from page to page in your code by assigning them to the session array.

 

page 1:

<?php
session_start();
$_SESSION['var1'] = "some data";
?>

 

page2 or 3 or 4 or whenver you want as long as the person keeps there browser open and comes back to your site:

<?php
session_start();
echo $_SESSION['var1'];
?>

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.