没改前:

 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. Ardupilot(PX4)飞控驱动蜂鸣器和RGB细节

    Ardupilot(PX4)飞控驱动蜂鸣器细节 飞控代码细节 任务调用频率50HZ(20ms),buzzer.update() 内部将频率减少到10HZ(100ms) 单响(SINGLE_BUZZ) ...

  2. 《java编程思想》多态与接口

    向上转型 定义:把某个对象的引用视为对其基类类型的引用的做法被称为向上转型方法调用绑定 将一个方法调用同一个方法主体关联起来被称作绑定. 前期绑定:程序执行前进行的绑定叫做前期绑定,前期绑定也是jav ...

  3. phpwind 安装下一步空白解决方案

    系统版本  centos 翻阅网上大部分都是php版本问题,让降级就行了,试了之后根本不行 其实再安装一个插件即可成功 如下: yum install -y php-mysql

  4. 《Java基础复习》-控制执行流程

    最近任务太多了,肝哭我了,boom 参考书目:Thinking in Java <Java基础复习>-控制执行流程 Java使用了C的所有流程控制语句 涉及关键字:if-else.whil ...

  5. maven聚合与继承笔记

    maven聚合 聚合的目的是为了快速构建项目,当我们有几个maven模块,想要一次性构建,而不是到每个模块下面去执行maven命令,这时候就需要使用maven聚合(或者称为多模块). 使用聚合的时候, ...

  6. 构建Mysql服务器

    <综合>构建Mysql服务器 构建MySQL服务器 数据库基本管理 MySQL 数据类型 表结构的调整 1 构建MySQL服务器 1.1 问题 本案例要求熟悉MySQL官方安装包的使用,快 ...

  7. 【mysql】mysql优化

    一,表设计 1.1. E-R(entity relation)实体关系图 长方形 实体 表 椭圆形 属性 字段 菱形 关系 一对一 多对一 属于 多对多 1.2. 三范式标准 原子性 个人信息 省市县 ...

  8. 按公式产生随机数、java中的重载、递归、有关计算机计算的问题

    1.按公式产生随机数x1=(16807*x)%(Integer.MAX_VALUE)x=x1;通过这个公式进行随机数的产生,当产生的数字大于2e+32-2时,在用产生随机数的方式进行数字的输出.主要思 ...

  9. 21 static 静态的使用及特点

    /* * static:他是一个关键字,用来修饰成员变量和成员方法 * static特点: * 被所有的对象所共享 * 可以直接使用类名来调用 * 静态所修饰的成员加载优先于对象,随着类的加载而加载 ...

  10. VM卸载不完全,重装的一个下午

    玩软件就是随时面临着重新来过的危险.今天一不小心就把VM给高爆了,爆的很高的那种. 卸载不完全的VM如何在不重装系统的情况下安装. 首先第一步,肯定是通过控制面板去卸载VM,但是....但是...我靠 ...