86Stang Posted January 21, 2008 Share Posted January 21, 2008 I've built a search form with a few dropdown menus and I would like to log the text of the search as well as the selected options in the dropdowns into a database. I know how to update records but I'm stumped on exactly how/where to execute said updates. Quote Link to comment https://forums.phpfreaks.com/topic/86997-solved-logging-a-search/ Share on other sites More sharing options...
mmarif4u Posted January 21, 2008 Share Posted January 21, 2008 could you be more specific. Quote Link to comment https://forums.phpfreaks.com/topic/86997-solved-logging-a-search/#findComment-444846 Share on other sites More sharing options...
86Stang Posted January 21, 2008 Author Share Posted January 21, 2008 I'll try. I have a text field and two dropdown menus that a user can use to search a database. What I would like to do is anytime a person uses the search, have the entered criteria logged into a database. For example if someone searched for term "cabinet" and opted for "wood" from the first dropdown and "4 drawers" from the second dropdown, it would log those three terms into the appropriate columns into a database when the user clicks the submit button (or hits Enter which seems to equal clicking the submit button). I've already got the database setup and I know how to insert/update records. I just don't know where I would inject such code. Quote Link to comment https://forums.phpfreaks.com/topic/86997-solved-logging-a-search/#findComment-444851 Share on other sites More sharing options...
mmarif4u Posted January 21, 2008 Share Posted January 21, 2008 Ok,1st tel us you want to search some specific record and show in the browser OR Want to update some specific record in the database according to that term entered in the inputs by user. Quote Link to comment https://forums.phpfreaks.com/topic/86997-solved-logging-a-search/#findComment-444855 Share on other sites More sharing options...
86Stang Posted January 21, 2008 Author Share Posted January 21, 2008 Both! I've got the display working just fine - I just need to plug in the inputs to the DB. Quote Link to comment https://forums.phpfreaks.com/topic/86997-solved-logging-a-search/#findComment-444859 Share on other sites More sharing options...
mmarif4u Posted January 21, 2008 Share Posted January 21, 2008 I think the better option here is to use switch statement. http://www.php.net/switch Use update command in every case to update db. case will take variables from dropdown. Quote Link to comment https://forums.phpfreaks.com/topic/86997-solved-logging-a-search/#findComment-444869 Share on other sites More sharing options...
86Stang Posted January 21, 2008 Author Share Posted January 21, 2008 Got it! I figured it out. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/86997-solved-logging-a-search/#findComment-444901 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.