Phanindra Posted November 5, 2013 Share Posted November 5, 2013 Hi , I am having two categories in a form with check boxes. one is Location and secong is Salary. if i click on a location and a salary range , the database values matching those fields should be displayed.If i uncheck them they should become invisible. I am trying for this since 4 days.Please help me with some code to do this. Thanks in advance.search-result.php Quote Link to comment https://forums.phpfreaks.com/topic/283615-getting-values-from-database-based-on-check-boxes/ Share on other sites More sharing options...
davidannis Posted November 5, 2013 Share Posted November 5, 2013 You need to use javascript. Lots of examples on the web. Try this one: http://stackoverflow.com/questions/18421082/show-hide-div-if-checkbox-selected Quote Link to comment https://forums.phpfreaks.com/topic/283615-getting-values-from-database-based-on-check-boxes/#findComment-1457042 Share on other sites More sharing options...
Phanindra Posted November 5, 2013 Author Share Posted November 5, 2013 That link is a nice example. But i need to get values from database for each checkbox if there are any matches. How can i do that... Please let me know. Thanks for your help Quote Link to comment https://forums.phpfreaks.com/topic/283615-getting-values-from-database-based-on-check-boxes/#findComment-1457045 Share on other sites More sharing options...
cyberRobot Posted November 5, 2013 Share Posted November 5, 2013 If you want to use JavaScript, you could use PHP to populate a JavaScript array. Once PHP is done and the page is sent to the browser, JavaScript can then be used to reference the information. You could try the following search for some examples: https://www.google.com/search?q=populate+a+javascript+array+with+php Note that you could also look into using AJAX to grab information from the database. Quote Link to comment https://forums.phpfreaks.com/topic/283615-getting-values-from-database-based-on-check-boxes/#findComment-1457056 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.