erich1 Posted November 6, 2009 Share Posted November 6, 2009 http://www.paddlingabc.com/index_exp.php Basically I have a drop down selection box which users select and then once they select it I load the information they want in the iframe below the box. It is a convenient way for me to manage a large amount of information that is not useful to everyone. As you can see it is broken down by city. I would like there to be a little checkbox below the selection box that when checked remembers the users selection the next time they visit. Please note only the calgary.php page is created. I am a little bit new to this so bear with me please. Thanks so much for taking the time. <li> <h2>Current Information</h2> <select onchange="sendValue(this);" name="config"> <option value="http://www.paddlingabc.com/sidebar/pincher.php">Pincher Creek, AB</option> <option value="http://www.paddlingabc.com/sidebar/lethbridge.php">Lethbridge, AB</option> <option value="http://www.paddlingabc.com/sidebar/calgary.php">Calgary, AB</option> <option value="http://www.paddlingabc.com/sidebar/reddeer.php">Red Deer, AB</option> <option value="http://www.paddlingabc.com/sidebar/edmonton.php">Edmonton, AB</option> <option value="http://www.paddlingabc.com/sidebar/banff.php">Banff, AB</option> <option value="http://www.paddlingabc.com/sidebar/canmore.php">Canmore, AB</option> <option value="http://www.paddlingabc.com/sidebar/jasper.php">Jasper, AB</option> <option value="http://www.paddlingabc.com/sidebar/golden.php">Golden, BC</option> <option value="http://www.paddlingabc.com/sidebar/invermere.php">Invermere, BC</option> <option value="http://www.paddlingabc.com/sidebar/revelstoke.php">Revelstoke, BC</option> <option value="http://www.paddlingabc.com/sidebar/fernie.php">Fernie, BC</option> <option value="http://www.paddlingabc.com/sidebar/play.php">Popular Playboating Runs</option> <option value="http://www.paddlingabc.com/sidebar/creeks.php">Popular Creeking Runs</option> </select> <script type="text/javascript"> function sendValue(myObj){ newLocation = myObj.options[myObj.selectedIndex].value; document.getElementById('theFrame').src = newLocation; } </script> <iframe id="theFrame" name="iframe" src="http://www.paddlingabc.com/sidebar/calgary.php" scrolling="no" align="top" height="600" width="220" frameborder="0"></iframe> </li> Quote Link to comment Share on other sites More sharing options...
gizmola Posted November 6, 2009 Share Posted November 6, 2009 Read the php manual section on php Session handling: http://us2.php.net/manual/en/book.session.php Alternatively, you could set this type of thing in a cookie. Quote Link to comment Share on other sites More sharing options...
erich1 Posted November 6, 2009 Author Share Posted November 6, 2009 Took a look at sessions. Looks like the ideal thing for me. Not sure exactly how to implemenent it all though. I figured this was a pretty common task with remembering countries, languages or something like that. Quote Link to comment Share on other sites More sharing options...
erich1 Posted November 6, 2009 Author Share Posted November 6, 2009 Still need a little help here...please. Quote Link to comment Share on other sites More sharing options...
Neville1985 Posted November 6, 2009 Share Posted November 6, 2009 Few things you could do here. $_SESSION vars are handy but the problem with them is the fact that after the browser closes, all values within the superglobal are reset and the var is empty. setcookie is a good way to handle this although I wouldn't rely on it because allot of people have accept cookies set to off. Two suggestions: 1/ Registration system. Then you can save the value to a database and be done with it. 2/ Or you can do an IP type system. There are a few ways of implementing the latter. One is checking the IP against and IP database, there are free versions out there but you will have to look for them for a while. You can get one here by paying a 'small' fee. http://www.ip2location.com/free.aspx Alternatively you can start your own, although this can be quite cumbersome and time consuming. You can log the persons IP and record their selection in a database, then write a script that checks IP's against database values, if a match then show the relevant data. etc etc. So many ways, just do some research on google and you ill find an option that suits you. Quote Link to comment Share on other sites More sharing options...
gizmola Posted November 6, 2009 Share Posted November 6, 2009 Few things you could do here. $_SESSION vars are handy but the problem with them is the fact that after the browser closes, all values within the superglobal are reset and the var is empty. setcookie is a good way to handle this although I wouldn't rely on it because allot of people have accept cookies set to off. Not following you here -- unless you take measures to reconfig this, sessions are facilitated by a cookie. They don't go away until they expire and you can set a long expiration if you want. For something like form memory I don't think you need to go crazy, but yo can easily set them to expire in 7 days or whatever you want. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.