Zeta
Zeta

Reputation: 11

Problem saving variables using PHP session

I seem to be having trouble saving session variables. I tried using session_status() and it outputs as 2. Maybe there's some way to check why session isn't saving properly?

Page1.php

<?php
    session_start();
?>
<body>
    <?php
        // Set session variables
        $_SESSION["favcolor"] = "green";
        $_SESSION["favanimal"] = "cat";
        echo "Session variables are set.";
    ?>
    <a href="Page2.php">Click Me</a>
</body>

Page2.php

 <?php
session_start();
?>
<body>

<?php
print_r($_SESSION);
?>

</body>

Upvotes: 0

Views: 60

Answers (1)

Zeta
Zeta

Reputation: 11

Turns out I had to add a tmp folder and add a php_flag output_buffering on

Upvotes: 1

Related Questions