Welcome Guest, Not a member yet? Register   Sign In
How to save the content of a textarea
#1

[eluser]JuanitoDelCielo[/eluser]
Im saving the content of my textarea, but each time that I save it it appends a new line.

Code:
Validation
$this->form_validation->set_rules('description', 'Descripción', 'required|trim');
//View
<?php echo form_textarea('description', set_value('description', $classified->description)); ?>

Any ideas?
#2

[eluser]Exangelus[/eluser]
How do you store the data (textfile, database?) and do you peform any manipulations?
A common error is to nl2br the data before saving it to the database but when you then load it into
a textarea and str_replace the br's back to newline's you in fact double the newline's because the database
added his own newlines behind the br's.

However to accurately help you it would be helpful if you post some more code or at least describe the process the data goes through..
#3

[eluser]joakley77[/eluser]
I've actually had the same thing happen in CI2.0. View the source and see if it's throwing in an extra <br /> after it posts.
#4

[eluser]TechXperts-Rajeev[/eluser]
[quote author="JuanitoDelCielo" date="1299882453"]Im saving the content of my textarea, but each time that I save it it appends a new line.

Code:
Validation
$this->form_validation->set_rules('description', 'Descripción', 'required|trim');
//View
&lt;?php echo form_textarea('description', set_value('description', $classified->description)); ?&gt;

Any ideas?[/quote]
Have you got solution? .. i am getting same problem with CI 2.0. Please post solution..
#5

[eluser]TechXperts-Rajeev[/eluser]
[quote author="TechXperts-Rajeev" date="1300981325"][quote author="JuanitoDelCielo" date="1299882453"]Im saving the content of my textarea, but each time that I save it it appends a new line.

Code:
Validation
$this->form_validation->set_rules('description', 'Descripción', 'required|trim');
//View
&lt;?php echo form_textarea('description', set_value('description', $classified->description)); ?&gt;

Any ideas?[/quote]
Have you got solution? .. i am getting same problem with CI 2.0. Please post solution..[/quote]

Here is a fix...
http://ellislab.com/forums/viewthread/180078/




Theme © iAndrew 2016 - Forum software by © MyBB