lucilue2003 Posted November 22, 2004 Posted November 22, 2004 HI, I want to be able to have a user click on a link and have the php remember the posted data. It seems that when they hit back or refresh, that posted data is gone. Is there a way to remember it throughout the time the user is on the site ? something like this: <a href=http://www.mysite.com/index.php?bgcolor=red>i want this to be my background color</a> $bgcolor = $_GET['bgcolor']; thanks.
Jack_mcs Posted November 22, 2004 Posted November 22, 2004 To make it apply to each visitor and to be remembered across sessions, you would need store the settings in the database. Jack Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons
Guest Posted November 22, 2004 Posted November 22, 2004 $bgcolor = $_GET['bgcolor']; tep_session_register('bgcolor');
lucilue2003 Posted November 25, 2004 Author Posted November 25, 2004 $bgcolor = $_GET['bgcolor']; tep_session_register('bgcolor'); <{POST_SNAPBACK}> Here's what i got: Fatal error: Call to undefined function: tep_session_register() in /home/elita/public_html/newsite/includes/configure.php on line 39 The function is there because when i place that code inside index.php it works fine. I really need it be done inside configure.php. based on the background color they choose, i have different database that load. is there a way so that i can get it to work? I tried this one trick but no luck: index.php: ... require('includes/application_top.php'); $currid = $_GET['currid']; tep_session_register('currid'); ALSO includes/configure.php if (!isset($currid)) $currid = $_GET['currid']; if ($currid =="red") define('DB_DATABASE', 'red'); else if ($currid =="blue") define('DB_DATABASE', 'blue'); else if ($currid =="orange") define('DB_DATABASE', 'orange'); when i load the index.php page http://www.mysite.com/index.php?currid=orange it says : 1046 - No Database Selected select configuration_key as cfgKey, configuration_value as cfgValue from configuration please help.
Guest Posted November 25, 2004 Posted November 25, 2004 But, make sure it is below the code in application_top.php that starts the session.
lucilue2003 Posted November 25, 2004 Author Posted November 25, 2004 here's my file layout: index.php require('includes/application_top.php'); $currid = $_GET['currid']; tep_session_register('currid'); application_top.php - // start the session $session_started = false; if (SESSION_FORCE_COOKIE_USE == 'True') {..} elseif (SESSION_BLOCK_SPIDERS == 'True') {..} else {..} $_SESSION['currid'] = $_GET['currid']; configure.php if (!isset($currid)) $currid = $_GET['currid']; if ($currid =="red") define('DB_DATABASE', 'red'); else if ($currid =="blue") define('DB_DATABASE', 'blue'); else if ($currid =="orange") define('DB_DATABASE', 'orange'); is this how it is supposed to be ? thanks.
Guest Posted November 25, 2004 Posted November 25, 2004 No...there is a lot of redundant code there. Also, a defined constant can only be defined once. What you are needing is a database abstraction layer which osC MS2 does not have.
lucilue2003 Posted November 25, 2004 Author Posted November 25, 2004 Is there a way i can do this without the database abstraction layer?
Recommended Posts
Archived
This topic is now archived and is closed to further replies.