简体   繁体   English

如何在PHP的文本框中显示会话变量的值

[英]how to display value of session variable in textbox in php

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 在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 在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. 也没有收到任何错误消息。

您没有在回显实际的$ _SESSION变量,需要这样做:

<input type="text" id="Editbox1" name="strt_date" value="<?PHP if(isset($_SESSION['date'])){echo $_SESSION['date'];}?>">

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM