forms - Passing php session variables non standard way -


i use following php code , html form pass "item_name" value 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 , use "item_name" value on downloading page this.

<?php session_start(); $item_name=$_post["item_name"]; ?> 

all works fine, have following problem hope solve here. after initial click want come same html page this:

<form action="" method="post"> 

then using javascript, generate link "download.php" , after able download file. problem time when i'm clicking newly generated link go "download.php" the

$_session['item_name']="item_name"; 

is lost. how can preserve session variable use on download page? thanks.

on download.php page, need set variable session variable:

<?php session_start(); $_session['item_name'] = $_post["item_name"]; ?> 

by doing above, variable stored in php session , available wherever call session_start().

the way have right is:

<?php session_start(); $item_name = $_post["item_name"]; ?> 

which make variable available within download.php page , else.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -