I’m learning Php & Mysql.
I’ve a database(practice) with 2 table. One is Category and other is sub-category.
In my html form there are a list of select box data which is come from Category table. So i need, if i select this list box, them another select box data will be appear from sub-category table which is related to Category table. For example:
Category table
Id Cat_name
1 O level
2 A level.
Sub-Category table:
id Cat_id Sub_name
1 1 O-level Math
2 1 O-level English
3 2 A-level Math
4 2 A-level English
Thanks in Advance.
If you want this to be done seamlessly and efficiently without page reloads you will need to look into the Jquery Ajax function. The way Ajax works is when someone makes a selection in the first box, it will send that data to a php script that can take the answer from the first box, run a mysql query, then return the new subcategories to the original page without having to reload the page.
Example:
In your test.php
In your caller.php
Please read up on Jquery.ajax