<?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. |
Write a PHP script that calculates the factorial of a given number using an iterative approach. |
Create a PHP script that prints the current date and time. |
Create a PHP script that calculates the average of an array of numbers. |
how to get country, state and city select option using google map api in php |
How to convert a temperature from Celsius to Fahrenheit using php. |
How to prevent SQL Injection using php |
Write a PHP script that calculates the sum of digits in a given number. |