Reputation: 356
Here I need to display text with break line but I simply display the html code inside the text area. Here is my code
<?php
$msg.="From :";
$msg.="<br/>";
$msg.="To :";
$msg.="Date :";
print_r($msg);
?>
<textarea><?php print_r($msg);?></textarea>
I need to print html executed code in text area. Thank you in advance.
Upvotes: 0
Views: 904
Reputation: 11342
HTML way to fix it, use ASCII characters 
 

.
Carriage return

Line feed


(HTML entity:

)REF: http://www.theasciicode.com.ar/ascii-control-characters/carriage-return-ascii-code-13.html
<textarea cols='60' rows='8'>This is line1 This is line2</textarea>
Upvotes: 4
Reputation: 118
You could try something like:
echo '<textarea>'.print_r($msg).'</textarea>';
Upvotes: 0
Reputation: 1816
Just replace your code from:
<textarea><?php print_r($msg);?></textarea>
to:
<textarea><?php echo $msg;?></textarea>
Upvotes: 0