| Getting PHP 5.2.x To Run on Mac Tiger 10.5 So, you decided to upgrade to Mac Tiger Workstation and your PHP service stopped working. No fear, as PHP will still work fine once you make a simple change to your Apache 2 configuration file. Previous versions of Mac OS 10.4 and below were using Ap... |
| PHP Session Management Tutorial (Part 2) - Storing and Retrieving Data |
|
|
|
In first part of this tutorial series we learned how to use PHP session_start() and session_register() function. Now, we are going to learn how to store data using session variables and then how to retrieve it on next page. We will show you this using the full script code which you can test at your end easily. -------------------------------- FILE 1 - phpsessionstore.php --------------------------------
Explanation: The file is started with HTML tags to show basic information. In the middle of web page, with the start of php tag, we used session_start() function to start the a new session and in next line assigned dollar variable a value. We closed the file information and link to the next file. -------------------------------- FILE 2 - phpsessionret.php -------------------------------- Code : Explanation: In second file we again started code with HTML tags and showed information to the user. With the start of PHP tag, we used the session_start() function. The if statement is used to check if the variable dollar exists or not. If the variable dollar exists a message with stored value of dollar will be displayed on user screen with the use of echo. So, in this tutorial you learned how to use session and how to retrieve stored values using session variables between multiples files. Please do share your feedback and comments in our forum which can be accessed from http://forum.phpreg.com We are coming up soon with exciting new tutorials! Please stay tuned! |
| < Prev | Next > |
|---|

