hello friend i have one question for navigate my website i have following field in my database table 1. Name 2. Category 3. City i want to display data in list.php user can go to list.php page by 1. clicking on list of category url is domain.com/list.php?category="category_name" 2. Clicking on City list of city url is domain.com/list.php?city="city_name" i do the above to matter successfully now i add one search box in list.php form is 1. <select name="category"><option value="category list"></option></select> 2. <select name="city"><option value="city list"></option></select> 3. <input type ="submit"> question is i want url like if user select both category and city url must be domain.com/list.php?category="category_name"&city="city_name" if user select only category url must be domain.com/list.php?category="category_name" and if user select only city url must be domain.com/list.php?city="city_name" Reputation sure for good answer thanks you
Hi Make your form action to list.php using get method. If only 1 select is choosen, the other will be like: domain.com/list.php?category=&city="city_name" . ie. There is nothing shown if not selected. At the top of your list.php, you must put this: if(isset($_GET['category'])) { $category=$_GET['category']; } if(isset($_GET['city'])) { $city=$_GET['city']; }
Hi anwara I use Get Method and Its Done, Thanks for your Answer, i add reputation Regards Nilesh valanki