Welcome Guest, Not a member yet? Register   Sign In
Retrieve data from file:
#1

[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")Wink;
$data['notice'] = readfile(base_url("notice.txt")Wink;
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.
#2

[eluser]LiquidFusi0n[/eluser]
I'm only new here, but could I please request you use the code tags? That's hard to read Smile

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 Smile

Hope this helps,
Regards,
LiquidFusi0n
#3

[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.
#4

[eluser]Mauricio de Abreu Antunes[/eluser]
Text file or database?




Theme © iAndrew 2016 - Forum software by © MyBB