<?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
Create a PHP script that uses sessions to store and display user information. |
How to check if a given number is a perfect number. |
Create a simple PHP script that calculates the sum of all even numbers between 1 and 10. |
How to prevent SQL Injection using php |
Write a PHP function that throws a custom exception if a condition is not met. |
How to show location using google map in JavaScript? |
how can i solve php header errors? |
Write a PHP script that generates and displays a list of the first 10 Fibonacci numbers. |