hi, i hava a php page and i want to send some variables and i wand to pass variables via session variable instead of post or get. this is my php code: <?php include("connection.php"); $pid = $_GET['pid']; $sl = $_GET['sl']; ?> pages.php?pid=<?php echo $row['pid'];?>&sl=<?php echo $row['sl'];?> PHP: can anybody convert this for sending variables via session? thanks in advance.
try: <?php session_start(); include("connection.php"); $_SESSION['pid'] = $_GET['pid']; $_SESSION['sl'] = $_GET['sl']; ?> pages.php PHP: On the pages.php page: <?php session_start(); $pid = $_SESSION['pid']; $sl = $_SESSION['sl']; //Use these as needed. ?> PHP: You should at some point clean the initial $_GET variables to make sure that a user isn't putting any malicious code in them.