![]() |
PHP problem - Help needed Hello programmers, I am developing a web page. now my problem is... I am working with relation database. I have a category and subcategory option and so in my form there are 2 list one category menu list and subcategory menu list. So I want to know that if I select a category from a list immediately show all subcategory of that selected category from database. Waiting for solution. |
Re: PHP problem - Help needed If you have the proper relations set and your db is relational yes it will... however you're a bit vague.. you might wanna include some more info like which database you are working with. |
Re: PHP problem - Help needed SteveSRS is right, your problem is not very clear. Do you want to know what DB structure to use for categories/subcategories and the way of relations between them, or do you want a solution for subcategories display on category selection (what's the DB structure then for categories and subcategories), or you might want to select a category submit and get a subcategory list... |
Re: PHP problem - Help needed What you'll need to do is some behind the scenes javascript. Disable the subcat dropdown so that people are forced to choose top-level cat first. When first cat is chosen, use AJAX to query for subcats of the chosen category. Or, if you don't want to use AJAX, you can build select boxes for all of the subcats, grouped by category parent, with css display:none. Then use onchange event on the main cat select to turn on the proper subcat select section. |
Re: PHP problem - Help needed Quote:
Subcategory Parent categoty (id) > category (id). And I want when a user click or select a category from category list, all the subcategory of that selected category will display on sub category menu... Similar with directory link submitted system.. someone click on main category after that subcategory option display. Hope my problem is now clear. |
Re: PHP problem - Help needed I think what your saying is that you have a drop down with categories and then want the sub categories to show based on the category selection. There are a couple ways to do this one is with JQUERY Chained Selects jQuery Plugin Another would be with PHP/JS ala AJAX |
Re: PHP problem - Help needed Quote:
HTML Code: <!DOCTYPE html> |
Re: PHP problem - Help needed Quote:
Basically youll need a SQL query with a where clause controlled by the first drop down. I can show you how to do it in ASP.NET and MSSQL. What are you on a Windows or Unix based server? What is your database MSSQL, MySQL, ...? |
Re: PHP problem - Help needed I'd say if you're not too deep in the project maybe you can try using WordPress as a framework. It has the categories other other taxonomies built-in. |
| All times are GMT -6. The time now is 12:52 PM. |