I have several values in cloud firestore and want to access every variables. Hence I do my code like this
<?php
require __DIR__.'/vendor/autoload.php';
use Google\Cloud\Firestore\FirestoreClient;
$db = new FirestoreClient(
[
'projectId' => 'fakedata-aa798'
]
);
$collectionReference = $db->collection('Test3');
$docRef = $collectionReference->document('User1');
$snapshot = $docRef->snapshot();
$Name= $snapshot['Name'];
$Contact= $snapshot['Contact no:'];
$Email= $snapshot['Email'];
$Location= $snapshot['Location'];
$Locationstatus= $snapshot['Location status'];
$Condition= $snapshot['Condition'];
session_start();
$_SESSION['Name'] = $Name;
$_SESSION['Contact no:'] = $Contact;
$_SESSION['Email'] = $Email;
$_SESSION['Location'] = $Location;
$_SESSION['Location status'] = $Locationstatus;
$_SESSION['Condition'] = $Condition;
?>
Now I want to display the values in next PHP files and I use session_start but still can't get the values
pages2
<?php
session_start();
echo $_SESSION['Name'];
?>
Can someone help me?