<?php
session_start();
// Set session variables
$_SESSION['username'] = 'john_doe';
$_SESSION['user_id'] = 123;
// Display session data
echo "Username: {$_SESSION['username']}, User ID: {$_SESSION['user_id']}";
?>
<?php
session_start();
// Set session variables
$_SESSION['username'] = 'john_doe';
$_SESSION['user_id'] = 123;
// Display session data
echo "Username: {$_SESSION['username']}, User ID: {$_SESSION['user_id']}";
?>
Related
Write a PHP script that sets a cookie with user preferences and retrieves it on subsequent visits. |
How to show location using google map in JavaScript? |
Create a PHP script that prints the current date and time. |
how can i solve php header errors? |
Create a PHP script that uses sessions to store and display user information. |
Create a PHP function to count the number of vowels in a string. |
How to prevent SQL Injection using php |
Create a PHP script that checks whether a given number is a prime number or not. |
