Jump to content

[SOLVED] introduction to session variables


dflow

Recommended Posts

here is what i want to achieve:

i want to get ref_id and store it as a session variable and if the user

reaches the contact form to store the session variable as a value.

 

for example:

mysite.com?ref_id=test

 

i understand i need to start a session and to $_GET it form the url

 

how would you approach it?

OK

this is a test code

<?php
session_start();
// store session data
$_SESSION['affid']=$_GET['affid'];
?>

<html>
<body>

<?php
//retrieve session data
echo "affid=". $_SESSION['affid'];
?>
<a href="http://XXXX.com/Contact.php">go to CONTACT</a>
</body>
</html>

 

i get the the affid from the URL parameter

it is echoed

the problem is that when i want to echo it on the next page

i get nothing.

if the the session is stored why is it not retrieved ?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.