php - session id passed but not session variables -
php - session id passed but not session variables -
i can see same session id echo on both pages . hello echoed on first page sec page session_['hello'];
says undefined variable. or if utilize isset seems show ts not beingness set on sec page.
is php.ini issue ?
class="snippet-code-html lang-html prettyprint-override"><?php if (version_compare(php_version, '5.4.0', '<')) { if(session_id() == '') {session_start();} } else { } echo session_id(); $_session['hello'] = 'yes'; echo $_session['hello']; ?> <a href="https://192.168.1.183/hello/b.php">gotob /a> <?php session_start(); if (isset($_session['hello'])){ echo $_session['hello']; } echo session_id(); ?>
elaborating on comment:
$_session
<= set in upper case $_session
.
it's superglobal , must in upper case letters.
plus, mention:
"but sec page session_['hello']; says undefined variable"
the syntax $_session['hello'];
you should create sure session_start();
within pages using sessions.
oh, , sidenote, , stated in comment:
<a href="https://192.168.1.183/hello/b.php">gotob /a>
the <
missing it.
<a href="https://192.168.1.183/hello/b.php">gotob</a>
php session
Comments
Post a Comment