echo form_textarea('general4', set_value('general4'), 'class="general"');
the set_value function doesn't seem to work with the textarea so I tried this:
<textarea name='general4' class="general"><?=set_value('general4')?></textarea>
But still not working, any ideas?
to use form_textarea() in CI you pass parameters rows and coloumns as below
$data = array(
'name' => 'txt_area',
'id' => 'txt_area',
'value' => 'johndoe',
'rows' => '5',
'cols' => '10',
'style' => 'width:50%',
);
echo form_textarea($data);
for more details refer CI user guide https://www.codeigniter.com/user_guide/helpers/form_helper.html#form_textarea
What you did is set the name of the textarea field to: 'general4'. I think what you meant to do is return an actual string to your textarea to pre-populate it with data from a post request or a MySQL database or something like that. There are a number of ways to achieve this.
Method 1: Set a second parameter in the set_value() function eg:
<textarea name='general4' class="general"><?=set_value('general4', $foo)?></textarea>
Method 2: You could always use the built in form_textarea() function. Docs found here Examples:
Generic
<?=form_textarea('name', 'value', 'attributs')?>
Case
<?=form_textarea('general4', $general4, "class = 'foo'")?>
Permits you to set the value of an input form or textarea. You must supply the field name via the first parameter of the function. The second (optional) parameter allows you to set a default value for the form.
<input type="text" name="quantity" value="<?php echo set_value('quantity', '0'); ?>" size="50" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With