When I submit my form I have set flash data, with a line from my language file. But I need to include the Uri
segment which is the id
in with it so it would out put like so Success: You have modified store id 20 settings!
Currently it shows id but in wrong place: Success: You have modified store id %s settings! 280
Language:
$lang['text_success'] = 'Success: You have modified store id %s settings!';
Set Flash Data
sprintf($this->session->set_flashdata('success', $this->lang->line('text_success') . $this->uri->segment(5)));
How can I make it so where the %s in language line the id will show when message is outputted?
Use this
I assume $this->uri->segment(5) is your id
$this->session->set_flashdata('success', sprintf($this->lang->line('text_success'), $this->uri->segment(5)));
I had another think about it and came up with this code here which works fine. I had to make another line with a variable and the place the variable in the set flash data.
$message = sprintf($this->lang->line('text_success'), $this->uri->segment(5));
$this->session->set_flashdata('success', $message);
Correct message out put now: Success: You have modified store id 280 settings!
And on language file:
$lang['text_success'] = 'Success: You have modified store id %s settings!';