没改前:

 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. Markdown语法快速学习

    Markdown 简洁语法说明 0.前言 一直以来都是以word文档做笔记,存在很多问题,比如代码格式.高亮等.这次公司要求使用markdown,感觉眼前一亮,以前word的问题都得到了解决,而且可以 ...

  2. JAVA研发面试题

    转自:http://www.jianshu.com/p/1f1d3193d9e3 Java基础的知识点推荐<Java编程思想>,JVM的推荐<深入理解Java虚拟机>,Spri ...

  3. Android学习----自定义Adapter实现ListView

    前言: 对于ListView而言,自定义的Adapter对于显示复杂的界面有很大的灵活性 .使用自定义的Adapter需要继承BaseAdapter,然后重写getCount(),getView(), ...

  4. 1064 Complete Binary Search Tree (30分)(已知中序输出层序遍历)

    A Binary Search Tree (BST) is recursively defined as a binary tree which has the following propertie ...

  5. LeetCode | 第180场周赛--5356矩阵中的幸运数

    给你一个 m * n 的矩阵,矩阵中的数字 各不相同 .请你按 任意 顺序返回矩阵中的所有幸运数. 幸运数是指矩阵中满足同时下列两个条件的元素: 在同一行的所有元素中最小 在同一列的所有元素中最大 示 ...

  6. pm2 开机启动egg项目

    1.在服务器上安装PM2 npm install pm2 -g 2.对PM2进行更新 pm2 update 3.进入服务器中egg项目更目录,并新建server.js文件,并在其中写入以下代码 con ...

  7. 微信小程序修改单选按钮的默认样式

    https://blog.csdn.net/abs1004/article/details/78922596

  8. 用robotframework 标准库String解决由于存在千分位分隔符导致两个数值不相等的问题。

    在编写robotframework自动化断言的过程中,我遇到了如下问题: 我想写一个两个金额判断是否相等的断言,其中一个金额是展示字段存在千分位分隔符,另一个金额是input带入字段,没有千分位分隔符 ...

  9. JQUERY滚动加载

    $(document).height():整个网页的高度$(window).height():浏览器可视窗口的高度$(window).scrollTop():浏览器可视窗口顶端距离网页顶端的高度(垂直 ...

  10. String 对象-->fromCharCode() 方法

    1.定义和用法 将ASCII码转换成对应的字符 语法: String.fromCharCode(n1, n2, ..., nX) 参数: n1, n2, ..., nX:一个或多个 Unicode 值 ...