没改前:

 if(!empty($search)){
$where['personal_name'] = array('like','%'. $search . '%');
$this -> assign('search',$search);
}
if(!empty($category)){
if($category == "请选择职位") $category=null;
$where['category_name'] = array('like','%'. $category . '%');
// $where['category_name'] = $category;
$this -> assign('category',$category);
}
if(!empty($type)){
switch ($type){
case "请选择简历类型":
$type = null;
break;
case "全职":
$where['resume_type'] = 1;
break;
case "兼职":
$where['resume_type'] = 2;
break;
default:break;
}
$this -> assign('type',$type);
}
if(!empty($education)){
switch($education){
case "请选择个人学历":
// $education = null;
break;
case "不限":
// $where['personal_education'] = 0;
break;
case "初中及以下":
$where['personal_education'] = 1;
break;
case "高中":
$where['personal_education'] = 2;
break;
case "中技/中专":
$where['personal_education'] = 3;
break;
case "大专":
$where['personal_education'] = 4;
break;
case "本科":
$where['personal_education'] = 5;
break;
case "硕士":
$where['personal_education'] = 6;
break;
case "MBA/EMBA":
$where['personal_education'] = 7;
break;
case "博士":
$where['personal_education'] = 8;
break;
case "博士后":
$where['personal_education'] = 9;
break;
default:break;
}
$this -> assign('education',$education);
}
if(!empty($working)){
switch($working){
case "请选择个人工作年限":
// $where['personal_working'] = 0;
break;
case "不限":
// $where['personal_working'] = 0;
break;
case "1年以下":
$where['personal_working'] = 1;
break;
case "1-2年":
$where['personal_working'] = 2;
break;
case "3-5年":
$where['personal_working'] = 3;
break;
case "6-7年":
$where['personal_working'] = 4;
break;
case "8-10年":
$where['personal_working'] = 5;
break;
case "10年以上":
$where['personal_working'] = 6;
break;
default:break;
}
$this -> assign('working',$working);
}
if(!empty($sex)){
switch($sex){
case "不限":
//
break;
case "男":
$where['personal_sex'] = 1;
break;
case "女":
$where['personal_sex'] = 2;
break;
default: break;
}
$this -> assign('sex',$sex);
}

html:

         <form method="get">
<select class="button text" style="background-color: white; color: #428bca;" name="category">
<option>请选择职位</option>
<foreach name='select_name' item='v' >
<option <if condition="($category eq $v[category_name])">selected="selected"</if> >{$v.category_name}</option>
</foreach>
</select>
<select class="button text" style="background-color: white; color: #428bca;" name="type">
<option>请选择简历类型</option>
<option <if condition="($type eq 全职)">selected="selected"</if> > 全职</option>
<option <if condition="($type eq 兼职)">selected="selected"</if> >兼职</option>
</select>
<select class="button text" style="background-color: white; color: #428bca;" name="education">
<option>请选择个人学历</option>
<option <if condition="($education eq 不限)">selected="selected"</if> >不限</option>
<option <if condition="($education eq 初中及以下)">selected="selected"</if> >初中及以下</option>
<option <if condition="($education eq 高中)">selected="selected"</if> >高中</option>
<option <if condition="($education eq '中技/中专')">selected="selected"</if> >中技/中专</option>
<option <if condition="($education eq 大专)">selected="selected"</if> >大专</option>
<option <if condition="($education eq 本科)">selected="selected"</if> >本科</option>
<option <if condition="($education eq 硕士)">selected="selected"</if> >硕士</option>
<option <if condition="($education eq MBA)">selected="selected"</if> >MBA/EMBA</option>
<option <if condition="($education eq 博士)">selected="selected"</if> >博士</option>
<option <if condition="($education eq 博士后)">selected="selected"</if> >博士后</option>
</select>
<select class="button text" style="background-color: white; color: #428bca;" name="working">
<option>请选择个人工作年限</option>
<option <if condition="($working eq 不限)">selected="selected"</if> >不限</option>
<option <if condition="($working eq '1年以下')">selected="selected"</if> >1年以下</option>
<option <if condition="($working eq '1-2年')">selected="selected"</if> >1-2年</option>
<option <if condition="($working eq '3-5年')">selected="selected"</if> >3-5年</option>
<option <if condition="($working eq '6-7年')">selected="selected"</if> >6-7年</option>
<option <if condition="($working eq '8-10年')">selected="selected"</if> >8-10年</option>
<option <if condition="($working eq '10年以上')">selected="selected"</if> >10年以上</option>
</select>
<select class="button text" style="background-color: white; color: #428bca;" name="sex">
<option>请选择性别</option>
<option <if condition="($sex eq 不限)">selected="selected"</if> >不限</option>
<option <if condition="($sex eq 男)">selected="selected"</if> >男</option>
<option <if condition="($sex eq 女)">selected="selected"</if> >女</option>
</select>
<div class="btn-group"></div>
<input type="text" class="search" placeholder="请输入个人姓名" name="search" value="{$search}" style="margin-left: 1%;"/>
<input type="submit" value="搜索" class=" text button" style="border: none; float: none; margin-left: 1%;" />
</form>

修改后:

$type_array = array("请选择简历类型","全职","兼职");
$education_array = array("请选择个人学历","不限","初中及以下","高中","中技/中专","大专","本科","硕士","MBA/EMBA","博士","博士后");
$working_array = array("请选择个人工作年限","不限","1年以下","1-2年","3-5年","6-7年","8-10年","10年以上");
$sex_array = array("不限","男","女"); if(!empty($search)){
$where['personal_name'] = array('like','%'. $search . '%');
$this -> assign('search',$search);
}
if(!empty($category)){
if($category == "请选择职位") $category=null;
$where['category_name'] = array('like','%'. $category . '%');
$this -> assign('category',$category);
}
if(!empty($type)){
switch ($type){
case $type_array[0]:
$type = null;
break;
case $type_array[1]:
$where['resume_type'] = 1;
break;
case $type_array[2]:
$where['resume_type'] = 2;
break;
default:break;
}
$this -> assign('type',$type);
}
if(!empty($education)){
switch($education){
case $education_array[0]:
// $education = null;
break;
case $education_array[1]:
// $where['personal_education'] = 0;
break;
case $education_array[2]:
$where['personal_education'] = 1;
break;
case $education_array[3]:
$where['personal_education'] = 2;
break;
case $education_array[4]:
$where['personal_education'] = 3;
break;
case $education_array[5]:
$where['personal_education'] = 4;
break;
case $education_array[6]:
$where['personal_education'] = 5;
break;
case $education_array[7]:
$where['personal_education'] = 6;
break;
case $education_array[8]:
$where['personal_education'] = 7;
break;
case $education_array[9]:
$where['personal_education'] = 8;
break;
case $education_array[10]:
$where['personal_education'] = 9;
break;
default:break;
}
$this -> assign('education',$education);
}
if(!empty($working)){
switch($working){
case $working_array[0]:
// $where['personal_working'] = 0;
break;
case $working_array[1]:
// $where['personal_working'] = 0;
break;
case $working_array[2]:
$where['personal_working'] = 1;
break;
case $working_array[3]:
$where['personal_working'] = 2;
break;
case $working_array[4]:
$where['personal_working'] = 3;
break;
case $working_array[5]:
$where['personal_working'] = 4;
break;
case $working_array[6]:
$where['personal_working'] = 5;
break;
case $working_array[7]:
$where['personal_working'] = 6;
break;
default:break;
}
$this -> assign('working',$working);
}
if(!empty($sex)){
switch($sex){
case $sex_array[0]:
//
break;
case $sex_array[1]:
$where['personal_sex'] = 1;
break;
case $sex_array[2]:
$where['personal_sex'] = 2;
break;
default: break;
}
$this -> assign('sex',$sex);
} $this -> assign('type_array',$type_array);
$this -> assign('education_array',$education_array);
$this -> assign('working_array',$working_array);
$this -> assign('sex_array',$sex_array);

html:

           <select class="button text" style="background-color: white; color: #428bca;" name="category">
<option>请选择职位</option>
<foreach name='select_name' item='v' >
<option <if condition="($category eq $v[category_name])">selected="selected"</if> >{$v.category_name}</option>
</foreach>
</select> <select class="button text" style="background-color: white; color: #428bca;" name="type">
<foreach name='type_array' item='v'>
<option <if condition="($type eq $v)">selected="selected"</if> >{$v}</option>
</foreach>
</select> <select class="button text" style="background-color: white; color: #428bca;" name="education">
<foreach name='education_array' item='v'>
<option <if condition="($education eq $v)">selected="selected"</if> >{$v}</option>
</foreach>
</select> <select class="button text" style="background-color: white; color: #428bca;" name="working">
<foreach name="working_array" item="v">
<option <if condition="($working eq $v)">selected="selected"</if> >{$v}</option>
</foreach>
</select> <select class="button text" style="background-color: white; color: #428bca;" name="sex">
<foreach name='sex_array' item='v'>
<option <if condition="($sex eq $v)">selected="selected"</if> >{$v}</option>
</foreach>
</select>

编程是要偷懒的

编程是要偷懒的--option简练写法的更多相关文章

  1. Javascript模块化编程(一):模块的写法

    Javascript模块化编程(一):模块的写法 作者: 阮一峰 原文链接:http://www.ruanyifeng.com/blog/2012/10/javascript_module.html ...

  2. vb编程中的选择结构语句的写法

    1996年,Bohra和Jacopin提出了结构化算法的3中种基本结构:顺序结构.选择结构和循环结构 目前已经得到证明,无论多么复杂的程序,都是由上面的3种基本结构中的一种或者多种的组合构成 在此笔者 ...

  3. Javascript模块化编程(一):模块的写法 (转)

    Javascript模块化编程(一):模块的写法 原文作者: 阮一峰 日期: 2012年10月26日 随着网站逐渐变成"互联网应用程序",嵌入网页的Javascript代码越来越庞 ...

  4. Javascript模块化编程(一):模块的写法(转)

    随着网站逐渐变成"互联网应用程序",嵌入网页的Javascript代码越来越庞大,越来越复杂. 网页越来越像桌面程序,需要一个团队分工协作.进度管理.单元测试等等......开发者 ...

  5. Javascript模块化编程(一):模块的写法 作者: 阮一峰

    声明:转载自阮一峰的网络日志 随着网站逐渐变成"互联网应用程序",嵌入网页的Javascript代码越来越庞大,越来越复杂. 网页越来越像桌面程序,需要一个团队分工协作.进度管理. ...

  6. Javascript模块化编程(一):模块的写法 (转载 学习中。。。。)

    转载地址:http://www.ruanyifeng.com/blog/2012/10/javascript_module.html 阮一峰 大神:http://www.ruanyifeng.com/ ...

  7. Javascript模块化编程(一):模块的写法【转】

    作者: 阮一峰 日期: 2012年10月26日 随着网站逐渐变成"互联网应用程序",嵌入网页的Javascript代码越来越庞大,越来越复杂. 网页越来越像桌面程序,需要一个团队分 ...

  8. [转] Javascript模块化编程(一):模块的写法

    随着网站逐渐变成"互联网应用程序",嵌入网页的Javascript代码越来越庞大,越来越复杂. 网页越来越像桌面程序,需要一个团队分工协作.进度管理.单元测试等等......开发者 ...

  9. (转)Javascript模块化编程(一):模块的写法

    随着网站逐渐变成"互联网应用程序",嵌入网页的Javascript代码越来越庞大,越来越复杂. 网页越来越像桌面程序,需要一个团队分工协作.进度管理.单元测试等等......开发者 ...

随机推荐

  1. java.lang.NoSuchMethodException: java.util.List.<init>()

    报错信息如下 java.lang.NoSuchMethodException: java.util.List.<init>() at java.lang.Class.getConstruc ...

  2. 「MoreThanJava」计算机发展史—从织布机到IBM

    「MoreThanJava」 宣扬的是 「学习,不止 CODE」,本系列 Java 基础教程是自己在结合各方面的知识之后,对 Java 基础的一个总回顾,旨在 「帮助新朋友快速高质量的学习」. 当然 ...

  3. Java时间戳获取

    Java时间戳获取方式: 1:New Date().getTime(); 2: System.currentTimeMillis();区别: New Date().getTime()的底层其实是Sys ...

  4. python--一些知识点

    一. ==和is的区别 1. ==意为左右两端的值是否相等 2. is意为,左边是否就是右边,python会检测左右两边的引用位置,相等才是True(注:一定范围内的数字,左右两边为True) 二. ...

  5. WTM asp.net core应用程序在Ubuntu上和CentOS上部署

    wtm在Ubuntu上和CentOS上部署 项目发布 在Visual Studio中右击Web项目,选择发布,如下图: Ubuntu安装.net core运行时 Ubuntu我是用的Vmware虚拟机 ...

  6. 打造一款 刷Java 知识的小程序(二)

    学习Java的神器已上线,面向广大Java爱好者! 之前写的一篇:打造一款 刷Java 知识的小程序(一) 一.第二版做了什么? 第一版小程序只具有初级展示功能,知识点都是hardcode在代码里面的 ...

  7. Linux网络安全篇,进入SELinux的世界(三)

    SELinux防火墙配套的服务 一.auditd 1.基本功能 将详细信息写入到 /var/log/audit/audit.log文件 2.设置开机自动启动 chkconfig --list audi ...

  8. 如何在云开发静态托管中使用Jekyll

    如何在云开发静态托管中使用Jekyll 介绍 Jekyll 是一个简单的博客形态的静态站点生产机器,通过它,我们可以搭建一个完整的可发布的静态博客网站. Jekyll 也可以运行在 GitHub Pa ...

  9. 34.2 字节流 InputStreamReader OutputStreamWriter

    使用方法同字符流,不一样的是数据类型是字节 copydemo public static void main(String[] args) throws IOException { InputStre ...

  10. python3(二十三)classInstance

    """ 类和实例和访问权限 """ __author__ = 'shaozhiqi' # class后面紧接着是类名,即Student,类名 ...