-1

Basically what I want is when the if statement doesn't return as empty and it runs the 2nd echo I also want to echo $_SESSION variables within that echo.

    <?php 

    $gallerystatus = $_SESSION['u_gallerypicture'];


    if(empty($gallerystatus)){

     echo'<p> No posts uploaded yet... To add a photo click the New Post button.</p>';

    }
    else{
    echo'
    <!-- Main container -->
    <div id="content-container">
    <div class="gallery group">
        <div class="grid">
            <a href="#">
                <img height="216.66" src=" <?php echo "../image-gallery-upload/images/" . $_SESSION["u_gallerypicture"]; ?> ">
                <span><?php echo $_SESSION["u_caption"]; ?></span>
            </a>
        </div>';}?>

1 Answers1

0
 <?php 

$gallerystatus = $_SESSION['u_gallerypicture'];


if(empty($gallerystatus)){

 echo'<p> No posts uploaded yet... To add a photo click the New Post button.</p>';

}
else{
echo'
<!-- Main container -->
<div id="content-container">
<div class="gallery group">
    <div class="grid">
        <a href="#">
            <img height="216.66" src="../image-gallery-upload/images/"' . $_SESSION["u_gallerypicture"] . '">
            <span> ' . $_SESSION["u_caption"] . '</span>
        </a>
    </div>';?>

Just try to concatenate it. You never need to open PHP tag before closing it.

Vahe Galstyan
  • 1,681
  • 1
  • 12
  • 25