dlcmpls Posted September 20, 2007 Share Posted September 20, 2007 Hi all. I have a problem that has stumped me. I have a web page that displays a list of businesses (pulled from a mysql db). On that page is a check box that, when ticked, allows the user to save that business for later review. So let's say my page shows 5 businesses. The user may want to save 1, 3, or all of the businesses. Saving the businesses works fine for me. Here's where I get stuck. I want the page to recognize when a user has already saved a business. So for example, if the user has already saved Business3, I want to replace the "save it" check box with a text message that says something like "You have already saved this business." I don't know how to make this happen. I don't really need coding help, I need an explanation of how I would conceptually do this sort of thing. Thanks dlc Quote Link to comment https://forums.phpfreaks.com/topic/70012-dynamically-displaying-a-saved-user-choice/ Share on other sites More sharing options...
GingerRobot Posted September 20, 2007 Share Posted September 20, 2007 It all rather depends on your exising set up as to how you would approach this. Personally, i'd aim to have an array of previously saved businesses (perhaps storing a unique id for each of them) taken from the database. Then, i would have a loop to output all of the businesses' info, with the option to save. Inside this loop i would check to see if the current business id is in the array of previously saved businesses. If it is, you display "already saved" if its not, you display the checkbox. Quote Link to comment https://forums.phpfreaks.com/topic/70012-dynamically-displaying-a-saved-user-choice/#findComment-351629 Share on other sites More sharing options...
redking Posted September 20, 2007 Share Posted September 20, 2007 Yeah, I would serialize an array and store it in the database. then when you unserialize it use $array[] to add new ones. Quote Link to comment https://forums.phpfreaks.com/topic/70012-dynamically-displaying-a-saved-user-choice/#findComment-351661 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.