• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
displaying a variable value in flashdata

#1
Rainbow 
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));
Reply

#2
Then $class_id must be empty...
Test your translation files with Translation Tester
Reply

#3
(03-24-2020, 02:25 PM)includebeer Wrote: Then $class_id must be empty...
Not empty. Already tested that.
Reply

#4
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 )
Reply

#5
(03-25-2020, 03:23 AM)InsiteFX Wrote: 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.
I have no issue with displaying the flashdata.  I'm having issues with the concatenation of the string with the variable.
Reply

#6
(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. 
Test your translation files with Translation Tester
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.