<?php
require_once("../global/checkuser2.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.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>添加数据</title>
<link rel="stylesheet" href="addmodify.css" />
<script>
function check(){
var name=document.getElementById("name").value;
var type=document.getElementsByName("leixing[]");
var banmian=document.getElementById("banmian").value;
var baojia=document.getElementById("baojia").value;
var meiti=document.getElementById("meiti").value;
var fangxiang=document.getElementsByName("fangxiang[]");
var zhekou=document.getElementById("zhekou").value;
if(name==""){
alert("竞争机构名称不能为空!");
return false;
}

 for(var $i=0;$i<type.length;$i++){  
                    if(type[$i].checked==true){
					return true; 
					}else{
					alert("投放广告类型不能为空!");
					return false;}
                }  
				
if(banmian==""){
alert("投放广告版面不能为空!");
return false;
}
if(baojia==""){
alert("大概报价不能为空!");
return false;
}
if(meiti==""){
alert("广告平媒名称不能为空!");
return false;
}
for(var $i=0;$i<fangxiang.length;$i++){  
                    if(fangxiang[$i].checked==true){
					return true; 
					}else{
					alert("广告主投方向不能为空!");
					return false;}
                } 
if(zhekou==""){
alert("折扣区间范围不能为空!");
return false;
}
}
</script>
</head>

<body>
<div class="bigdiv">
<table cellspacing="0" cellpadding="0" style="font-size:14px;"><tr><td style="text-align:left;border-left:none;">您的位置：<a href="index.php">每周平媒报告</a>/<a href="add.php">添加近日数据</a></td><td style="text-align:right;border-left:none;"><a href="index.php">返回</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td></tr></table>
<div class="list">
<form action="function.php?mod=add" method="post" onsubmit="return check()">
<div class="content">
<ul>
<li>竞争机构名称：<select id="name" name="name">
<option value="">竞争机构名称</option>
<?php
require_once("../global/connect.php");
$sql=mysql_query("select * from reportc where type='竞争机构名称'");
while($row=mysql_fetch_array($sql)){
echo "<option value='$row[name]'>$row[name]</option>";
}
?>
</select></li>
<li>投放广告类型：
<?php
$sql=mysql_query("select * from reportc where type='投放广告类型'");
while($row=mysql_fetch_array($sql)){
echo "<input type='checkbox' name='leixing[]' value='$row[name]'>$row[name]";
}
?>
</li>
<li>投放广告版面：<select id="banmian" name="banmian">
<option value="--">投放广告版面</option>
<?php
$sql=mysql_query("select * from reportc where type='投放广告版面'");
while($row=mysql_fetch_array($sql)){
echo "<option value='$row[name]'>$row[name]</option>";
}
?>
</select><select id="color" name="color">
<option value="彩色">彩色</option>
<option value="黑白">黑白</option>
<option value="夹页">夹页</option>
<option value="其他">其他</option>
</select>
大概报价：<input id="baojia" name="baojia" type="text" value="0"/>
</li>
<li>广告平媒名称：<select id="meiti" name="meiti">
<option value="--">广告平媒名称</option>
<?php
$sql=mysql_query("select * from reportc where type='广告平媒名称'");
while($row=mysql_fetch_array($sql)){
echo "<option value='$row[name]'>$row[name]</option>";
}
?>
</select>
</li>
<li>广告主投方向：
<?php
$sql=mysql_query("select * from reportc where type='广告主投方向'");
while($row=mysql_fetch_array($sql)){
echo "<input type='checkbox' name='fangxiang[]' value='$row[name]'>$row[name]";
}
?>
</li>
<li>折扣区间范围：<select id="zhekou" name="zhekou">
<option value="--">折扣区间范围</option>
<?php
$sql=mysql_query("select * from reportc where type='折扣区间范围'");
while($row=mysql_fetch_array($sql)){
echo "<option value='$row[name]'>$row[name]</option>";
}
?>
</select>
</li>
<li>活动主题备注：<textarea cols="40" rows="3" id="beizhu" name="beizhu">&nbsp;</textarea></li>
<li style="text-align:center;height:40px;line-height:40px;"><input type="submit" value="提交" class="btn"/>&nbsp;&nbsp;<input type="reset" value="重置" class="btn"/></li>
</ul>
</div>
</form>
</div>
</div>
</body>
</html>
