Welcome Guest, Not a member yet? Register   Sign In
set_value lost when using Redirect.
#1

[eluser]lordoffriends[/eluser]
Ok here is the scenario.I am populating the dropdown from Database.When ever the form is submitted,i need to do two things

1) persist the value selected in dropdown.
2) using session->set_flashdata(),i need to set the custom database message.

Now as we know,we need to redirect before this flash data can be set.

This is the code which i have written.

if ($this->form_validation->run() == TRUE){

$this->session->set_flashdata('msg', 'Taha Hasan');
redirect(current_url());

$this->ShowReceiveInventoryView();
}

Also i m using set_select in the dropdown view to persist the value.

<select name="myselect">
<option value="one" &lt;?php echo set_select('myselect', 'one', TRUE); ?&gt; >One</option>
<option value="two" &lt;?php echo set_select('myselect', 'two'); ?&gt; >Two</option>
<option value="three" &lt;?php echo set_select('myselect', 'three'); ?&gt; >Three</option>
</select>

Now here is the problem...The flash message appears BUT because i am redirecting to the current page,the drop down set_select value is lost !!! Default value appears in the selection Sad..If i remove the redirect line,the dropdown value is presisted but Flash data is not set !!!

Hope you guys have a solution to this problem...




Theme © iAndrew 2016 - Forum software by © MyBB