Php 如何在codeigniter中搜索后保留选定的框选项
如何在搜索后保留所选框选项。当我选择所选选项并搜索它时,我希望打印。它应该在搜索后显示我在搜索前选择的内容Php 如何在codeigniter中搜索后保留选定的框选项,php,codeigniter,Php,Codeigniter,如何在搜索后保留所选框选项。当我选择所选选项并搜索它时,我希望打印。它应该在搜索后显示我在搜索前选择的内容 这是我的查看页面 ITR状态 您的逻辑是正确的,但您在选项标记中出错 <!doctype html> <html> <body> <div> <?php if(isset($response)){ echo "<b>Name :</b> ".$response['txt_name
这是我的查看页面
ITR状态
您的逻辑是正确的,但您在选项标记中出错
<!doctype html>
<html>
<body>
<div>
<?php
if(isset($response)){
echo "<b>Name :</b> ".$response['txt_name']."<br/>";
echo "<b>Username :</b> ".$response['txt_uname']."<br/>";
echo "<b>Email :</b> ".$response['txt_email']."<br/>";
}
?>
</div>
<form method='post' action='<?php echo base_url(); ?>'>
<table>
<tr>
<td>Name</td>
<td><input type='text' name='txt_name'></td>
</tr>
<tr>
<td>Username</td>
<td><input type='text' name='txt_uname'></td>
</tr>
<tr>
<td>Email</td>
<td><input type='text' name='txt_email'></td>
</tr>
<tr>
<td> </td>
<td><input type='submit' name='submit' value='Submit'></td>
</tr>
</table>
</form>
</body>
</html>
好的,我给你举个例子,告诉你怎么做
查看
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class User extends CI_Controller {
public function __construct() {
parent::__construct();
// load base_url
$this->load->helper('url');
}
public function index(){
$data = array();
// Check form submit or not
if($this->input->post('submit') != NULL ){
// POST data
$postData = $this->input->post();
$data['response'] = $postData;
}
// load view
$this->load->view('user_view',$data);
}
}
更改查看页面代码
ITR状态
你能给出你想要的清晰视图吗?我想在submiton submit上打印选项值,提交到你想要打印的地方。在同一页的不同页面中,在搜索后的选择框中,你能舍弃完整的代码吗?提交后仍不工作不打印我选择的内容。
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class User extends CI_Controller {
public function __construct() {
parent::__construct();
// load base_url
$this->load->helper('url');
}
public function index(){
$data = array();
// Check form submit or not
if($this->input->post('submit') != NULL ){
// POST data
$postData = $this->input->post();
$data['response'] = $postData;
}
// load view
$this->load->view('user_view',$data);
}
}
<?= form_open("../Admin/getRecords"); ?>
<div class="" style="height:5.5vw;border-bottom:1.2px solid lightgrey;padding:.5%;">
<div class="col col-lg-3" style="margin-left:41%;margin-top:0%;padding-bottom: 2%;">
<label>ITR Status</label>
<select name="ITRStatus" id="ITRStatus" class="form-control chosen" style="height:2.5vw;" id="sel">
<?php
$name = set_value('ITRStatus');
if(count($alldata)):
foreach($alldata as $data): ?>
<option value="<?php echo $data->id; ?>" <?php if($name == $data->id){ echo "selected"; } ?>><?php echo $data->itr_status; ?></option>
<?php endforeach;endif; ?>
</select>
</div>