Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
How To Save Values to the Current Session
How To Save Values to the Current Session? - PHP Script Tips - Understanding and Using Sessions
✍: 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.
2007-04-18, 5304👍, 0💬
Popular Posts:
What metrics will you look at in order to see the project is moving successfully? Most metric sets d...
How To Create an Array in PL/SQL? - Oracle DBA FAQ - Introduction to PL/SQL If you want create an ar...
How can I construct preprocessor if expressions which compare strings? You can't do it directly; pre...
How To Decrement Dates by 1? - MySQL FAQs - Introduction to SQL Date and Time Handling If you have a...
How To Use "IN OUT" Parameter Properly? - Oracle DBA FAQ - Creating Your Own PL/SQL Procedures and F...