![]() |
Retrieve data from file: - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Retrieve data from file: (/showthread.php?tid=49731) |
Retrieve data from file: - El Forum - 03-01-2012 [eluser]phparif[/eluser] How can i put data in textbox and textarea, data is in a text file. My code is: in model: function RetrieveTitleNotice(){ $data['title'] = readfile(base_url("title.txt") ![]() $data['notice'] = readfile(base_url("notice.txt") ![]() return $data; } in controller: $data['notice'] = $this->dataViewRM->RetrieveTitleNotice(); $this->load->view('Register/notice',$data); in view: $data = array( 'name' => 'txtNotice', 'id' => 'txtNotice', 'value' => $notice[title], 'size' => '63', 'tabindex' => '0' ); $noticeTitle = form_input($data); echo $noticeTitle; $data = array( 'name' => 'noticeBody', 'id' => 'noticeBody', 'value' => $notice[notice], 'rows' => '15', 'cols' => '60', 'tabindex' => '1' ); $noticeBody = form_textarea($data); echo $noticeBody; But it show number of character in textbox and textarea.Now how can i do. Retrieve data from file: - El Forum - 03-01-2012 [eluser]LiquidFusi0n[/eluser] I'm only new here, but could I please request you use the code tags? That's hard to read ![]() In regards to your question, you can't just reference an array as a whole which you are doing here. I wouldn't use form_textarea personally. Just reference what you want directly using PHP also you want to print_r($data[0]['notice']). Same for title, I believe that will contain the content that you are wanting to retrive, then just reference them inside a textarea tag ![]() Hope this helps, Regards, LiquidFusi0n Retrieve data from file: - El Forum - 03-01-2012 [eluser]phparif[/eluser] Actually i want to retrieve data from text file or database and put this data in a textbox or in a textarea. If it is raw coding i do this: <input type="text" id="txtNotice" name="txtNotice" value="<?php print $sr[0];?>"> <textarea id="noticeBody" rows="15" cols="60" name="noticeBody"><?php print $sr[1];?></textarea> But,in CodeIgniter framework how can i do this. Retrieve data from file: - El Forum - 03-01-2012 [eluser]Mauricio de Abreu Antunes[/eluser] Text file or database? |