網頁特效給select動態增加資料並由php教程接受保存到資料
<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "HTTP://www.w3.org/tr/xhtml1/dtd/ xhtml1-transitional.dtd">
<html xmlns="HTTP://www.jzread.com/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;
保存資料庫教程操作
}
?>