{"id":66,"date":"2012-07-18T19:01:36","date_gmt":"2012-07-18T19:01:36","guid":{"rendered":"http:\/\/faq.pctrickers.com\/?p=66"},"modified":"2023-04-01T20:15:14","modified_gmt":"2023-04-01T20:15:14","slug":"codeigniter-send-retrieve-data-flash-messages","status":"publish","type":"post","link":"https:\/\/webexplorar.com\/codeigniter-send-retrieve-data-flash-messages\/","title":{"rendered":"CodeIgniter send and retrieve data using flash messages"},"content":{"rendered":"<p>How to send and get data by using flash messages in the codeigniter.This is simple and passing data using array.But if you reload\/refresh the page, your data may not be displayed.Because data passing using flash message.However you can pass huge of data through this method.<br \/>\n<!--more--><\/p>\n<pre class=\"lang:php decode:true \">\n$userDetails = array();  \/\/ declare the array\n$userDetails['id'] = 10;\n$userDetails['user_name'] = 'John';\n$userDetails['amount'] = $250;\n\/\/create flash message\n$this->session->set_flashdata('UserData', $userDetails);\n<\/pre>\n<p>You can get this details like this.<\/p>\n<pre class=\"lang:php decode:true \">\n\/\/ get array\n$usersPaymentData = $this->session->flashdata('UserData');\n\/\/ display details\necho $usersPaymentData['id'];\necho $usersPaymentData['user_name'];\necho $usersPaymentData['amount'];\n\/\/ simply\nprint_r($usersPaymentData);\n<\/pre>\n<p>Same way as simply,<br \/>\n<strong>In the controller.<\/strong><\/p>\n<pre class=\"lang:php decode:true \">\n$myArr = array('value 1', 'value 1');\n$this->session->set_flashdata('myArray', $myArr);\n<\/pre>\n<p><strong>View file<\/strong><\/p>\n<pre class=\"lang:php decode:true \">\nprint_r($this->session->flashdata('myArray'));\n<\/pre>\n<p>If your flash messages are not working, then you must read this post.<br \/>\n<a href=\"http:\/\/webexplorar.com\/codeigniter-flash-message-doesnt-work\" title=\"Codeigniter flash message doesn't work\" target=\"_blank\" rel=\"noopener noreferrer\">Codeigniter flash message doesn&#8217;t work<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to send and get data by using flash messages in the codeigniter.This is simple and passing data using array.But if you reload\/refresh the page, your data may not be displayed.Because data passing using flash message.However you can pass huge of data through this method.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[125,1],"tags":[22],"class_list":["post-66","post","type-post","status-publish","format-standard","hentry","category-codeigniter","category-recent-posts","tag-validations","post--single"],"aioseo_notices":[],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/webexplorar.com\/wp-json\/wp\/v2\/posts\/66","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webexplorar.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webexplorar.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webexplorar.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/webexplorar.com\/wp-json\/wp\/v2\/comments?post=66"}],"version-history":[{"count":1,"href":"https:\/\/webexplorar.com\/wp-json\/wp\/v2\/posts\/66\/revisions"}],"predecessor-version":[{"id":3985,"href":"https:\/\/webexplorar.com\/wp-json\/wp\/v2\/posts\/66\/revisions\/3985"}],"wp:attachment":[{"href":"https:\/\/webexplorar.com\/wp-json\/wp\/v2\/media?parent=66"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webexplorar.com\/wp-json\/wp\/v2\/categories?post=66"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webexplorar.com\/wp-json\/wp\/v2\/tags?post=66"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}