Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php send values in $_SESSION to other page

<?php
//PAGE 1
// Start the session
session_start(); //<- IMPORTANT TO SET IT AT THE TOP IN PAGE 1
?>
<!DOCTYPE html>
<html>
<body>

<?php
// Set session variables
$_SESSION["favcolor"] ="green";
$_SESSION["favanimal"] ="cat";
echo "Session variables are set.";
?>
---------------------------------------------------------------
<?Php
//Page2:
session_start(); //<- IMPORTANT TO SET IT AT THE TOP IN PAGE 2
echo "my favcolor is".$_SESSIO["favcolor"];/*here it will display my fav color is green*/
?>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #php #send #values #page
ADD COMMENT
Topic
Name
6+9 =