Tools, FAQ, Tutorials:
Saving Values in the Session in PHP
How To Save Values to the Current Session in PHP?
✍: FYIcenter.com
When session is turned on, a session will be automatically created for you by the PHP engine. If you want to save any values to the session, you can use the pre-defined associative array called $_SESSION. The following PHP script shows you how to save values to the session:
<?php
session_start();
print("<html><pre>");
$_SESSION["MyLogin"] = "FYICenter";
print("A value saved in the session named as MyLogin.\n");
$_SESSION["MyColor"] = "Blue";
print("A value saved in the session named as MyColor.\n");
print("Click <a href=next_page.php>Next Page</a>"
." to retrieve the values.\n");
print("</pre></html>\n");
?>
If you save this script to your Web server as first_page.php and visit it with a browser, you will get:
A value saved in the session named as MyLogin. A value saved in the session named as MyColor. Click Next Page to retrieve the values.
⇒ Retrieving Values Stored in Session in PHP
⇐ Turning on the Session Support in PHP
2023-12-25, ∼2760🔥, 1💬
Popular Posts:
How to add a new operation to an API on the Publisher Dashboard of an Azure API Management Service? ...
What is EPUB 2.0 Metadata "dc:publisher" and "dc:rights" elements? EPUB 2.0 Metadata "dc:publisher" ...
How to start Visual Studio Command Prompt? I have Visual Studio 2017 Community version with Visual C...
How To Get the Minimum or Maximum Value of an Array in PHP? If you want to get the minimum or maximu...
Where to get a real Atom XML example? You can follow this tutorial to get a real Atom XML example: 1...