php + js 勾选A select 同步B select,该如何处理

WBOY
Release: 2016-06-13 12:19:41
Original
1047 people have browsed it

php + js 勾选A select 同步B select
要如何写勾选A时,B会同步?

<br /><select id="A" name="A" ><br /><?php<br />	$query = $db->query("<br />	SELECT * FROM `select`"); 		<br />	foreach($query->result() as $row){	<br />?>  <br /><option value="<?php echo $row->id;?>"><?php echo $row->name;?></option><br /><?php<br />	}<br />?>  <br /></select><br />          <br />  <br /><?php<br />	$query = $db->query("<br />	SELECT * FROM `test`"); 		<br />	foreach($query->result() as $row){	<br />?>  <br /><select id="B" name="B[]" ><br /><?php<br />	$query1 = $db->query("<br />	SELECT * FROM `select`"); 		<br />	foreach($query1->result() as $row){	<br />?>  <br /><option value="<?php echo $row1->id;?>"><?php echo $row1->name;?></option><br /><?php<br />	}<br />?>  <br /></select><br /><?php<br />	}<br />?> <br />
Copy after login

------解决思路----------------------
首先用js控制,a修改时,b也修改。
然后a onchange时,执行一个ajax,更新db

Related labels:
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