如何用动态html在php中显示Session值?

<?php                            
       session_start();
       echo "<b>Start Date:</b>$_SESSION['Date']<br />";
       echo "<b>Venue:</b>$_SESSION['address']<br />";
       echo "<b>Church Name: </b>$_SESSION['ChurchLead']<br />";
       echo "<b>Course Type </b>$_SESSION['coursename']<br />";
       echo "<b>Participants: </b>$_POST['NumbPart']<br />";
       echo "<b> Latitude: </b>$_SESSION['lat']<br />";
       echo "<b> Longitude: </b>$_SESSION['long']<br />";
?>

Is this a correct way of displaying Session values in php? I am getting blank values.

try this ,this is not better????? simple & easy read

<?php
   session_start();
?>
   <b>Start Date:</b><?=$_SESSION['Date'];?><br />
   <b>Venue:</b><?=$_SESSION['address'];?><br />
   <b>Church Name: </b><?=$_SESSION['ChurchLead'];?><br />
   <b>Course Type </b><?=$_SESSION['coursename'];?><br />
   <b>Participants: </b><?=$_POST['NumbPart'];?><br />
   <b> Latitude: </b><?=$_SESSION['lat'];?><br />
   <b> Longitude: </b><?=$_SESSION['long'];?><br />

To display the value from an array like that as string sub, you need to use {} around it in the string. For example:

echo "<b> Latitude: </b>$_SESSION['lat']<br />";

becomes

echo "<b> Latitude: </b>{$_SESSION['lat']}<br />";

This applies to instances where you are trying to access an array member, or accessing an object member (such as myObj->foo)

NOTE: I am operating under the assumption that your session array is completely valid.

First, change all lines to:

  echo "<b>MyVar:</b>".$_SESSION['myVar']."<br />";

Now, unless you have set the variable $_SESSION['MyVar'], you'll get blank output.