hi I have registered session in "page1.php" as session_start(); session_register('client_id', $client_id); session_register('client_name', $client_name); How can I access these values in the other page "page2.php". I have tried as: session_start(); if(session_is_registered('client_id')){ echo $client_id; } but no result is displayed. But when I include "page1.php" in "page2.php" as include "page1.php"; then I can access it. Does it mean that I have to include "page1.php" in all pages of my application? Any solution please. Thanks Joseph
Something tells me you are going about what you are doing the wrong way. Anyway, your script is relying on register_globals which may be disabled and is also using deprecated functions, here is the way to do it: page1: session_start(); $_SESSION['client_id'] = $client_id; $_SESSION['client_name'] = $client_name; page 2: session_start(); echo $_SESSION['client_id'];
register_globals is Enabled but still there was problem. By deprecated functions, do you mean that they are no more functional? The application was running without any problem few months back, and I am still using the same PHP version and Apache version. Anyhow, If I do it the way you suggests, then how would I check: if(session_is_registered('client_id')){ } Please help, I am new in PHP.
besthostworld, please use default fonts and colours, it looks ugly otherwise. jbashir, the equivalent to if(session_is_registered('client_id')) is: if (isset($_SESSION['client_id'])) And by deprecated, I mean they are not recommended to be used and may be omitted from later PHP versions.
Will be omitted in this case. register_globals will be completely removed in php 6.0; the concept will no longer exist.