php 返回界面显示值
php
比如 我点击查询 <form action="<?php echo base_url('test/index'); ?>" method="GET"><table> <tr> <td>名字</td> <td><input id="aname" value="<?php echo $this->input->get('aname');?>"/></td><!-- 上面这句在搜索返回刷新页面的时候回把传进去的参 返回到输入显示 这句没问题--> </tr> <tr> <td>文凭</td> <td><select id="wenping" name="wenping" value="<?php echo $this->input->get('wenping');?>"> <option value=''>请选择</option> <option value="1">高中</option> <option value='2'>大学</option> </select><!-- 问题就是下拉框这句了,比如说我选择了高中查询 怎么显示高中? 而不是一搜索就又选中了请选择 --> </td> </tr></table></form>
回复讨论(解决方案)
//#1<?php foreach(array(''=>'请选择', 1=>'初中', 2=>'高中') as $k=>$n):?><option value='<?php echo $k;?>' <?php if($this->input->get('k') == $k) echo '选中。。';?>><?php echo $n;?></option><?php endforeach;?>#2<option value='' <?php if(get == '') echo '选中'>请选择</option> <option value="1" if(get == 1) echo 选中>高中</option> <option value='2' if(get == 2) .....>大学</option>#3将get保存到hidden,然后用js获取,再选中
用php判断加上红色的部分
比如说你选择了高中查询
那么提交后将会有 $_GRT['wenping'] => 1
据此就可以进行后续工作了
比如说你选择了高中查询
那么提交后将会有 $_GRT['wenping'] => 1
据此就可以进行后续工作了
那个wenpin 是界面下拉框 也有可能选择大学,版主你那代码我不是很理解,能全面一点吗
<tr> <td>名字</td> <td><input id="aname" value="<?php echo $this->input->get('aname');?>"/></td><!-- 上面这句在搜索返回刷新页面的时候回把传进去的参 返回到输入显示 这句没问题--> </tr>
下拉框就想实现 上面的效果把自己选择的值 显示出来,不是一搜索 页面已刷新 下拉框值又变成了“请选择”
//#1<?php foreach(array(''=>'请选择', 1=>'初中', 2=>'高中') as $k=>$n):?><option value='<?php echo $k;?>' <?php if($this->input->get('k') == $k) echo '选中。。';?>><?php echo $n;?></option><?php endforeach;?>#2<option value='' <?php if(get == '') echo '选中'>请选择</option> <option value="1" if(get == 1) echo 选中>高中</option> <option value='2' if(get == 2) .....>大学</option>#3将get保存到hidden,然后用js获取,再选中
-------------------------------------------
为什么一点击搜索 页面自动一刷新 下拉框值 又变成了 “请选择”
<option value='0' <?php if($this->input->get('wenping') == '0'){echo 'selected="selected"';}?>>请选择</option><option value="1" <?php if($this->input->get('wenping') == '1'){echo 'selected="selected"';}?>>高中</option><option value='2' <?php if($this->input->get('wenping') == '2'){echo 'selected="selected"';}?>>大学</option>

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Alipay PHP...

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

The application of SOLID principle in PHP development includes: 1. Single responsibility principle (SRP): Each class is responsible for only one function. 2. Open and close principle (OCP): Changes are achieved through extension rather than modification. 3. Lisch's Substitution Principle (LSP): Subclasses can replace base classes without affecting program accuracy. 4. Interface isolation principle (ISP): Use fine-grained interfaces to avoid dependencies and unused methods. 5. Dependency inversion principle (DIP): High and low-level modules rely on abstraction and are implemented through dependency injection.

Session hijacking can be achieved through the following steps: 1. Obtain the session ID, 2. Use the session ID, 3. Keep the session active. The methods to prevent session hijacking in PHP include: 1. Use the session_regenerate_id() function to regenerate the session ID, 2. Store session data through the database, 3. Ensure that all session data is transmitted through HTTPS.

How to automatically set the permissions of unixsocket after the system restarts. Every time the system restarts, we need to execute the following command to modify the permissions of unixsocket: sudo...

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

How to debug CLI mode in PHPStorm? When developing with PHPStorm, sometimes we need to debug PHP in command line interface (CLI) mode...
