0

I was trying the "$_SESSION" function, but it didn't work. Here are the codes.

test1.php

    <?php
    session_start();
    $_SESSION['testid']= "12";
    ?>
    <!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>Test Page</title>
    </head>
    <body>
    <h1><?php echo $_SESSION['testid']; ?></h1>
    </body>
    </html>

The output was:

    12

test2.php

    <?php
    session_start();
    ?>
    <!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>Test Page 2</title>
    </head>
    <body>
    <h1><?php echo $_SESSION['testid']; ?></h1>
    </body>
    </html>

The output was nothing.

So, what is the problem?

0 Answers0