I am trying to allow a user to choose which currency to use on an ecommerce site and by choosing, set up a session var with a directory value stored in it that I can access to determine which sub site to use. Here is my code from the entry page that is relavent:
Code: Select all
<?php
session_start();
if (isset($_SESSIONї'path'])) {
if ($_SESSIONї'path'] == "/canada") {
header ("Location: /canada/index.php");
} elseif ($_SESSIONї'path'] == "/us") {
header ("Location: /us/index.php");
}
}
?>Code: Select all
<a HREF="/canada/index.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('currency_page_r4_c2','','/assets/images/index/currency_page_r4_c2_f3.gif',1)"><img SRC="/assets/images/index/currency_page_r4_c2.gif" ALT="" NAME="currency_page_r4_c2" WIDTH="145" HEIGHT="20" BORDER="0" onClick="<?php $_SESSIONї'path'] = "/canada" ?>"></a>Code: Select all
<?php
session_cache_limiter('none');
session_start();?>
<?php
if (isset($_SESSIONї'path'])) {
echo "Session set and Chosen Directory is: " . $_SESSIONї'path'] . "<br>";
} ?>Now if the user goies to another page in this subsite, the session value seems to be gone or not available. I use the same code as above to test if the value is there and nothing is output. Also, I have a link on all these sub pages to unset $_SESSION['path'] and take the user back to the entry page to choose another currency. The code is:
Code: Select all
<a HREF="/index.php" onClick="XMkillCookie('currency')" onMouseUp="<?php unset($_SESSIONї'path']) ?>">SWITCH CURRENCY</a>Anyone have any help for me? I would sincerely appreciate it as this is driving me a bit crazy.
Cheers
Dave