1 Star 0 Fork 0

vworld / surfing-helper

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
ads.php 5.19 KB
一键复制 编辑 原始数据 按行查看 历史
guilei.li 提交于 2014-08-08 18:44 . 分楼层显示
<?php
$ad_category=array(
'3c'=>array(
'title'=>'3c数码',
childCat=>array(
'bjb'=>array(
'title'=>"笔记本"
),
'sj'=>array(
'title'=>"手机"
)
)
),
'mm'=>array(
'title'=>'美女视频聊天',
childCat=>array()
),
'health'=>array(
'title'=>'健康养生',
childCat=>array(
'am'=>array(
'title'=>'按摩'
),
'yyp'=>array(
'title'=>'营养品'
)
)
)
);
$options = "";
foreach($ad_category as $key=>$value){
$title = $value[title];
$childCat = $value[childCat];
$options = $options."<optgroup class='cat-1' value='".$key."' label='".$title."'>";
foreach($childCat as $ckey=>$cvalue){
$options=$options.("<option class='cat-2' value='".$ckey."'>".$cvalue[title]."</option>");
}
$options=$options."</optgroup>";
}
?>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>请输入广告信息</title>
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="http://cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<script src="js/jquery-1.9.0.js"></script>
</head>
<body>
<style>
textarea{
width: 550px;
height: 150px;
overflow: auto;
}
.vertical-align-top{
vertical-align: top;
}
input{
width: 300px;
}
body{
padding: 20px;
}
.cat-1{
font-weight: bold;
}
.cat-2{
padding-left: 5px;
}
</style>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<!--<script src="http://cdn.bootcss.com/jquery/1.11.1/jquery.min.js"></script>-->
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
<div class="container-fluid">
<div class="row-fluid">
<div class="span10">
<form action="addAd.php" accept-charset="utf-8" method="post" enctype="multipart/form-data">
<fieldset>
<label>商品名称:</label>
<input type="text" name="ad_title">
<br>
<label>价格  :</label>
<input type="text" name="ad_price">
<br>
<label>商品地址:</label>
<input type="text" name="ad_target_url">
<br>
<label>广告类型:</label>
<select name="ad_type">
<option value="0">图片广告</option>
<option value="1">iframe广告</option>
</select>
<!--<input type="text" placeholder="0:图片广告 1:iframe广告" name="ad_type">-->
<br>
<label>所属频道:</label>
<select id="ad_category" name="ad_category_2">
<?php
echo($options);
?>
<!-- <option value="0">用品</option>-->
<!-- <option value="1">3c</option>-->
<!-- <option value="2">视频聊天</option>-->
<!-- <option value="3">按摩</option>-->
</select>
<!--<input type="text" placeholder='0:用品 1:3c 2: 视频聊天 3:按摩' name="ad_category">-->
<br>
<label class="vertical-align-top">图片链接:</label>
<textarea rows="3" placeholder="多条链接请换行" name="ad_material_urls"></textarea>
<br>
<label>来源  :</label>
<input type="text" placeholder="网站域名,如:taobao.com" name="ad_from"></input>
<br>
<button type="button" class="btn btn-submit">提交</button>
<button type="reset" class="btn btn-reset">重置</button>
</fieldset>
</form>
</div>
</div>
</div>
<script>
$("form .btn-submit").click(
function(){
var inputs = $("form input,form textarea, form select");
var data = {};
for(var i = 0; i < inputs.length; i++){
data[inputs[i].name]=inputs[i].value;
}
data.ad_category = document.getElementById("ad_category").selectedOptions[0].parentNode.getAttribute("value");
$.ajax({
type:"post",
url:"addAd.php",
data:data,
success:function(){
$(".btn-reset")[0].click();
}
})
}
);
</script>
</body>
</html>
CSS
1
https://gitee.com/vworld/surfing-helper.git
git@gitee.com:vworld/surfing-helper.git
vworld
surfing-helper
surfing-helper
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891