Passing Variable Using Session
Posted: Wed Apr 28, 2010 8:50 am
On the "first.php" page, the variable value(inside the session) deliver successfully, but on the "next.php" the session display nothing.
Its weird, since I also use session for login system and work without problem.
This is code from page before "first.php".
first.php Result:
--------------
Product : 12
Size : 1
--------------
next.php Result
-----------
Product :
Size :
-----------
Its weird, since I also use session for login system and work without problem.
This is code from page before "first.php".
Code: Select all
<form name=\"update\" method=\"post\" action=\"z_reg_sess.php?prod_id=$prod_id\">Code: Select all
<?
//first.php
include "function.php";
connect();
$_SESSION['prod_id'] = $_GET['prod_id'];
$_SESSION['size_id'] = htmlentities($_POST['size_id'], ENT_QUOTES);
echo "Product : ".$_SESSION['prod_id'];
echo "<br>";
echo "Size : ".$_SESSION['size_id'];
echo "<br>";
echo "<a href=\"z_next.php\">Next</a>";
?>
--------------
Product : 12
Size : 1
--------------
Code: Select all
<?
//next.php
include "function.php";
connect();
session_start();
$_SESSION['prod_id'] = $prod_id = $_GET['prod_id'];
$_SESSION['size_id'] = $size_id = $_GET['size_id'];
echo "Product : ".$_SESSION['prod_id'];
echo "<br>";
echo "Size : ".$_SESSION['size_id'];
?>
-----------
Product :
Size :
-----------