三级联动---填写表单式
来源:互联网 发布:js的find方法 编辑:程序博客网 时间:2024/06/07 19:46
<?php
header("Content-Type:text/html;charset=UTF-8");
//连接数据库
mysql_connect("localhost","root","123");
mysql_select_db("bbs");
$ww=mysql_query("set names 'utf8'");
function show($f_id){
//根据地址
$sql="select * from class where f_id ='".$f_id."'";
$rs=mysql_query($sql);
if($rs){
//echo $rs;
//将查询的结果封装成html标记
//echo mysql_num_rows($rs);
while($rows=mysql_fetch_assoc($rs)){
$arr=explode("-",$rows['f_id']);
$strs='';
for($i=1;$i<count($arr);$i++){
$strs.="--";
}
echo '<option value='.$rows['id'].'>'.$strs.$rows['name']."</option>";
show($rows['f_id']."-".$rows['id']);
}
} else{
exit();
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body>
<form action="1.php" method="post">
<select name="show" id="show">
<?php
show(0);
?>
</select>
<input type="text" name="add" id="add">
<input type="submit" name="submit" id="submit" value="提交">
</form>
</body>
</html>
<?php
//print_r($_POST);
if(isset($_POST['submit'])){
//判断插入的长度
if(isset($_POST['add'])){
$sql1="select id,f_id from class where id=".$_POST['show'];
$rs1=mysql_query($sql1);
$str='';
while($rows1=mysql_fetch_assoc($rs1)){
$str=$rows1['f_id']."-".$rows1['id'];
}
$sql2="insert into class values('','".$str."','".$_POST['add']."')";
$rs2=mysql_query($sql2);
if($rs2){
echo "<script>alert('成功插入');</script>";
}
}
}
?>
header("Content-Type:text/html;charset=UTF-8");
//连接数据库
mysql_connect("localhost","root","123");
mysql_select_db("bbs");
$ww=mysql_query("set names 'utf8'");
function show($f_id){
//根据地址
$sql="select * from class where f_id ='".$f_id."'";
$rs=mysql_query($sql);
if($rs){
//echo $rs;
//将查询的结果封装成html标记
//echo mysql_num_rows($rs);
while($rows=mysql_fetch_assoc($rs)){
$arr=explode("-",$rows['f_id']);
$strs='';
for($i=1;$i<count($arr);$i++){
$strs.="--";
}
echo '<option value='.$rows['id'].'>'.$strs.$rows['name']."</option>";
show($rows['f_id']."-".$rows['id']);
}
} else{
exit();
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body>
<form action="1.php" method="post">
<select name="show" id="show">
<?php
show(0);
?>
</select>
<input type="text" name="add" id="add">
<input type="submit" name="submit" id="submit" value="提交">
</form>
</body>
</html>
<?php
//print_r($_POST);
if(isset($_POST['submit'])){
//判断插入的长度
if(isset($_POST['add'])){
$sql1="select id,f_id from class where id=".$_POST['show'];
$rs1=mysql_query($sql1);
$str='';
while($rows1=mysql_fetch_assoc($rs1)){
$str=$rows1['f_id']."-".$rows1['id'];
}
$sql2="insert into class values('','".$str."','".$_POST['add']."')";
$rs2=mysql_query($sql2);
if($rs2){
echo "<script>alert('成功插入');</script>";
}
}
}
?>
- 三级联动---填写表单式
- 中国地区三级联动表单
- asp实现三级联动表单
- 实现年月日表单三级联动
- 三级联动下拉表单的源代码
- jQuery表单省市区城市三级联动
- 三级联动
- 三级联动
- 三级联动
- 三级联动
- 三级联动!
- 三级联动
- 三级联动
- 三级联动
- 三级联动
- 三级联动
- 三级联动
- 三级联动
- ueditor绑定后台值问题
- 使用iptables进行端口重定向(转发)
- 马云语录
- nagios监控的短信提醒—飞信机器人的安装
- compiz破坏桌面环境后的恢复办法
- 三级联动---填写表单式
- C# 中的委托和事件
- java基础学习笔记(一)Object类
- Kettle 启动报错 Invalid byte 1 of 1-byte UTF-8 sequence
- 如何获得下拉数据集下拉框的显示值
- UML 文章收集
- Posix多线程编程学习笔记(一)
- JQuery 中的ajax的方法 ($.ajax,$.post.$get,$.jgetJSON)
- 用properties写的一个程序运行次数计数的程序代码,超过次数提示注册。