ghurty Posted August 17, 2007 Share Posted August 17, 2007 Hi I am trying to change something with the following query, but I have no idea how to go about it. Currently my query takes a variable from a preset setting: $catid = trim( $params->get( 'catid' ) ); And then runs a query in a script, and displays the results. However, what I am trying to do, is that instead of pulling the information in from a preset setting, I want the end user to be able to choose what category they want to display results from. So.... I am trying to get it that it should check a cookie to see if the user has a already chosen a category, if yes it will display the results of from that category, and give the user a choice to switch but if not, it should just say that you can choose which category, you want. All that should be simple, and I think I know how to create the cookie and check for a cookie. But I dont know how to take the results of the cookie and stick it into the parameter AND then to refresh. And to make it that the variable that is inputed (ex: 45) is displayed as a text choice (ex: Homes) Also, Is there a way I can make it, that instead of a regular drop down box, to choose your category, there is a button that creates a nice pop up (but without it being a pop up window) allowing you to choose. Also, Is there a way to make it, that if they choose or make a change, the entire page doesn't need to reload, only this particular section? I know this is a long question, but any help will be most appreciated. Thank you Here is how I think to handle the cookie information: if(isset($_GET['category'])){ $category = $_GET['category']; setcookie('category', $category); } elseif(isset($_COOKIE['category'])){ $category = $_COOKIE['category']; } else{ setcookie('category', '45'); $category = "category"; } Quote Link to comment https://forums.phpfreaks.com/topic/65366-hot-to-allow-user-to-change-what-category-a-query-is-run-on/ Share on other sites More sharing options...
ghurty Posted August 17, 2007 Author Share Posted August 17, 2007 All that should be simple, and I think I know how to create the cookie and check for a cookie. But I dont know how to take the results of the cookie and stick it into the parameter AND then to refresh. And to make it that the variable that is inputed (ex: 45) is displayed as a text choice (ex: Homes) I figured some of this out, but I still dont know how to get it to refresh on the fly. Quote Link to comment https://forums.phpfreaks.com/topic/65366-hot-to-allow-user-to-change-what-category-a-query-is-run-on/#findComment-326761 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.