I have two input fields and one dropdown in a form. When I put data to these three, I click the search button. After that I come to another page. But after the redirect to the previous page how to keep previous selected value in dropdown and two input fields.
<input type="text" id=first>
<input type="text" id=second>
<select id=oid>
<option></option>
</select>
<div class="col-md-4">
<button type="button" onclick="location.href = '<?php echo base_url(); ?>/index.php/Orders/'" class="btn btn-primary btn-md">Back </button>
</div>
any help thanks in advance
You can use GET method to achieve this result
<form method="get" action="<?php echo base_url(); ?>/index.php/Orders/'">
<input type="text" id=first name="first">
<input type="text" id=second name="second">
<select id=oid>
<option></option>
</select>
<div class="col-md-4">
<button type="submit" class="btn btn-primary btn-md">Back </button>
</div>
Your URL will be like this
http://somedomain.com/index.php/Orders/?first=john&second=Doe
Edit
But when you want to keep the post values for sometime in the application even you moving around to other pages, you may think of session in PHP
In Codeignite way, it will be as follows
$this->session->set_userdata('first', $_POST['first']);
To get this value
$this->session->userdata('first');
Sample input element in your case
$first = $this->session->userdata('first');
<input type="text" id=first name="first" value="<?php echo $first?>">