Share hidden values from one page to the next via a session
I have a some hidden values in one page. I want to create a session and 开发者_JS百科navigate with the hidden fields to the next page or another page and access the hidden values.
How can I do that? Please give me an example.
Try:
<form action="blah.php">
<input type="hidden" name="the_value" value="content" />
Then do the following in php:
<?
session_start(); // Start the session
$_SESSION['the_value'] = $_POST['the_value'];
?>
Now you have the value stored in the session. Be careful if you want to save this to MySQL. You need to sanitize the string first!
精彩评论