I have created a php session and have assigned data like so
session_start();
$_SESSION['desd']=$imgD;
When i try to retrieve it on other page i get nothing.
this is what i have done on second page,
session_start();
$_imgname = $_SESSION['desd'];
How to do that?
The code is valid, assuming that the variable
$imgDis defined (var_dumpis one way of checking this, butprintorechomay also work).Check to ensure that cookies are enable in your browser.
Also, be sure that session_start() comes near the top of your script, it should be the first thing sent to the client each time.
To test a session, create “index.php” with the following code:
Reload the page several times and you should see an incrementing number.
An example of passing session variables between two pages is as follows:
PageOne.php
PageTwo.php
For simplicity put PageOne.php and PageTwo.php in the same directory. Call PageOne.php and then PageTwo.php.
Try also tutorials here, here, and here.