richrock Posted April 23, 2008 Share Posted April 23, 2008 Hi all, I'm trying to do a keyword search linked to categories. This gives the user a few options on how to display the results from a search. The options are a Text box, used to search by keywords and a Select list, generating the categories the items belong to. When the user hits 'Submit', the results should be displayed depending on : If they didn't type anything - generate an error statement. If they typed a keyword, but did not select a category - generate results of all items regardless of category. If they selected a category, but did not type a keyword - generate results of all items in selected category. If they typed a keyword, and selected a category -generate results of all items in the category matching the keyword. Now... I don't have a problem with the mysql commands, but I'm tying myself up in knots trying to figure out how to get to the results I need... I have worked out : if (($_POST['lotkeyword'] == NULL) || ($_POST['keyword'] == 'sale')) { error message here } (note - 'sale' is a default value in the select list, all the others are numbers (1003, 1004, 1005 etc) and : } else { if(($_POST['lotkeyword']) || ($_POST['keyword'])) { results of both searched terms here } but can't get the code to display keyword results on their own ('lotkeyword') or categories ('keyword')... Does anyone have any ideas how to do this, or have I confused everyone as well as myself (again)?? Rich Link to comment https://forums.phpfreaks.com/topic/102491-display-search-results-problem/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.