Reputation: 1033
<textarea name="notes"rows="2" cols="70" readonly><?php if(!empty($this->log_note)){ echo $this->log_note;} ?>
</textarea><br><br>
<label for="add_note"> Add Note </label>
<textarea name="add_note" rows="2" cols="70">
</textarea>
Lets say I have a text area in a form that displays data from a database table.
Now I have another text area field, and when I enter data it will update the above table field with the data entered.
$post_notes=$this->post['notes'];
$post_add_note=$post_notes."<br>".$this->post['add_note'];
$add_note_update=$this->db->query("
UPDATE notes SET note='$post_add_note' WHERE id='$hidden_id'
");
Now next time when I display the text area field with the name 'notes', I want the data in the text area to be displayed in a newline. i.e My
tag should work or is there any other way to display it with a line break?
NOTE: I will take care of the SQL injection scenarios, but I want to get my logic right first.
Upvotes: 0
Views: 1451
Reputation: 1
Best way when u typing your data in textarea please add at the end of line "< br />" It will start printing next data in new line.
eg: abc< br /> xyz< br />
output look like:
abc
xyz
Upvotes: 0
Reputation: 3358
Any line breaks in the space between the <textarea></textarea>
tags are displayed in the text box. If you replace "<br>"
with "\n"
it should work.
Upvotes: 1