没改前:

 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实现3次找到假球

    前言 之前老师让写一个程序,就写了写. 正文 题目要求 程序要求 10个铅球中有一个假球(比其他铅球的重量要轻),用天平三次称出假球. 程序设计思路 第一次使用天平分别称5个球,判断轻的一边有假球:拿 ...

  2. 读者来信 | 如何判断HBase Major Compact是否执行完毕?(已解决)

    前言:之前有朋友加好友与我探讨一些问题,我觉得这些问题倒挺有价值的:于是就想在本公众号开设一个问答专栏,方便技术交流与分享,专栏名就定为:<读者来信>.欢迎关注本人微信公众号<HBa ...

  3. Java内存可见性volatile

    概述 JMM规范指出,每一个线程都有自己的工作内存(working memory),当变量的值发生变化时,先更新自己的工作内存,然后再拷贝到主存(main memory),这样其他线程就能读取到更新后 ...

  4. rest_framework-序列化-1

    序列化 定义模型类 from django.db import models # Create your models here. class StuModel(models.Model): SEX_ ...

  5. (js描述的)数据结构[哈希表1.2](9)

    一. 优秀的哈希函数 1.快速的计算: 需要快速的计算来获得对应的hashCode(霍纳法则来减少乘除次数) 2.均匀的分布: 尽可能将元素映射到不同的位置,让元素在哈希表中均匀分布 二.哈希表的扩容 ...

  6. Git 常见问题 冲突原因分析及解决方案

    仅结合本人使用场景,方法可能不是最优的 1. 忽略本地修改,强制拉取远程到本地 主要是项目中的文档目录,看的时候可能多了些标注,现在远程文档更新,本地的版本已无用,可以强拉 git fetch --a ...

  7. 三、ARP协议和ICMP协议

    一.ARP协议 网络设备有数据要发送到另一台网络设备时,必须要知道对方的网络层地址(IP).IP地址由网络层来提供,但是仅有IP地址是不够的,IP数据报文必须封装成帧才能通过数据链路进行发送.数据帧必 ...

  8. leetcode Perform String Shifts

    Perform String Shifts You are given a string s containing lowercase English letters, and a matrix sh ...

  9. web.page.regexp用法(全网唯一)

    前言 因为这个东西“web.page.regexp”,差点把自己杀了.一点都不夸张,这将近30度的天气,办公室不开空调,又要闷,还要带着口罩,躁动的很.加上这个鬼东西“web.page.regexp” ...

  10. 011-指针(上)-C语言笔记

    011-指针(上)-C语言笔记 学习目标 1.[掌握]字符串常用函数 2.[掌握]指针变量的声明 3.[掌握]指针变量的初始化 4.[掌握]函数与指针 5.[掌握]指针的数据类型 6.[掌握]多级指针 ...