Passing php session variables non standard way
I use the following PHP code and HTML form to pass the "item_name" value
to downloading page.
<?php
session_start();
$_SESSION['item_name']="item_name";
?>
...
<form action="download.php" method="post">
<input type="hidden" name="item_name" value="133076">
<input type="submit" value="download">
</form>
I receive and use the "item_name" value on downloading page like this.
<?php
session_start();
$item_name=$_POST["item_name"];
?>
All this works fine, but I have the following problem that I hope to solve
here. After initial click I want to come back to the same html page like
this:
<form action="" method="post">
then do something using JavaScript, generate the link to "download.php"
and after that be able to download the file. The problem is that by the
time when I'm clicking the newly generated link to go to "download.php"
the
$_SESSION['item_name']="item_name";
is already lost. So how I can preserve this Session variable to use it on
download page? Thanks.
No comments:
Post a Comment