Reputation: 103
in my project I need to take the value of selected link from one page to another page and it should be display in the textbox.
for this i have used session variable code is as below :
in caledar.php
This is not the entire script ... there is one class which generates the calendar code. below is the function.
function getDateLink($day, $month, $year)
{
// Only link the first day of every month
$link = "";
if ($day)
{
$selectedDate = $day.$month.$year;
var_dump($selectedDate);die;
//session_register("$selectedDate");
//session_start();
if (isset($_GET["selectedDate"]))
$_SESSION['date'] = $selectedDate;
//("location:login_sucessful.php");
$link = "Leave_app.php";
}
return $link;
}
in application.php
<input type="text" id="Editbox1" name="strt_date" value="<?PHP
if(isset($_SESSION['date'])){echo $selectedDate;}?>">
It is not working. also not receiving any error message.
Upvotes: 0
Views: 6226
Reputation: 2872
You're not echoing the actual $_SESSION variable, it would need to be done like this:
<input type="text" id="Editbox1" name="strt_date" value="<?PHP if(isset($_SESSION['date'])){echo $_SESSION['date'];}?>">
Upvotes: 1