The general idea is this: in order not to let the previous page refresh, I used an IFRAME to sneak into a two-level sub-page, to read the data in the database, and finally pass the desired data to the parent page, complete the selection and transfer of data.
The main program code is as follows (some code changes, but does not affect functionality):
Parent page reg.html:
Sub-page city.php:
Please select your province include_once ("db.php"), $sql = "SELECT * from Province order by sh_id ASC"; $result =mysql_query ($sql); ROW=MYSQL_FETCH_ASSOC ($result)) {?>" > }?>
Select your city if (!empty ($_get["sh_id")) {//echo "OK", $sql = "SELECT * from city where sh_id=". $_get["sh_id"]. "ORDER by CI ty_id ASC "; $result =mysql_query ($sql); while ($row =mysql_fetch_assoc ($result)) {?>"> }?>
The above describes the Php+javascript with the php+javascript to achieve two-level cascading menu production, including the php+javascript aspects of the content, I hope that the PHP tutorial interested in a friend helpful.