Use php+javascript to create a second-level cascading menu_PHP tutorial

WBOY
Release: 2016-07-21 15:52:08
Original
775 people have browsed it



The general idea is this: In order to prevent the previous page from refreshing, I used an iframe to sneak into a secondary sub-page to read the data in the database, and finally pass the desired data to the parent page to complete the selection and transfer of data.

The main program code is as follows (part of the code has been changed, but it does not affect the function):
Parent page reg.html:



Sub-page city.php:




< select name="city" onchange="parent.document.getElementById('city').value=this.value">

< ?php
if(!empty($_GET[”sh_id”])){
//echo “ok”;
$sql=”select * from city where sh_id=”.$_GET[” sh_id"]." order by city_id asc";
$result=mysql_query($sql);
while($row=mysql_fetch_assoc($result)){
?>

}
}
?>


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/319018.htmlTechArticleThe general idea is this: In order to prevent the previous page from refreshing, I used an iframe to sneak into a secondary sub-page , used to read the data in the database, and finally pass the desired data to the parent...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template