displaying a variable value in flashdata |
I am trying to display the value of a id given to a class via a flash message. Currently is is only displaying the string section of the message ie. "Your class code is: " so the issue is the concatenation of the string and the variable. However, when i have tried just displaying the variable without the string section nothing appears. Do I need to pre-process the variable before I set it in the flash data?
The code is: $this->session->set_flashdata('class_id', ('Your class code is: '.$class_Id));
Your doing it wrong your code is setting flash data not returning it for display.
PHP Code: 'Your class code is: '.$this->session->flashdata('class_id'); Will display the flashdata. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(03-25-2020, 03:23 AM)InsiteFX Wrote: Your doing it wrong your code is setting flash data not returning it for display.I have no issue with displaying the flashdata. I'm having issues with the concatenation of the string with the variable.
(03-25-2020, 06:33 AM)amci Wrote: I have no issue with displaying the flashdata. I'm having issues with the concatenation of the string with the variable. Then flashdata has nothing to do with your bug. You say $class_id is not empty and you did the concatenation ( 'Your class code is: '.$class_Id ) but you also say the concatenation is not working. This doesn’t make sense. This variable is empty. There’s no magic way to concatenate two variables. Re-read your code, or post it here. But with the little information we have, there’s no other explanation. |
Welcome Guest, Not a member yet? Register Sign In |