<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.111cn.net/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<title>网页特效给select动态增加数据并由php接受保存到数据</title>
<script language="网页特效">
function onclickadd(id,cityname,obj)
{
var opt = new option(cityname,id);
obj.options.add(opt);
var c = obj.options.length-1;
obj.options[c].selected=true;
}
</script>
</head><body>
<form id="form1" name="form1" method="post" action="">
<select name="select1" id="select">
<option value="1">值一</option>
</select>
<input type="button" name="button2" value="增加" onclick="onclickadd('1000-2000','1000-2000',select1);"/>
<input type="submit" name="button" id="button" value="提交" />
</form>
</body>
</html>
<?
if( $_post )
{
$value = $_post['select'];
echo $value;
保存数据库教程操作
}
?>