Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

(PHP text area) How to print my text area message exactly as i type it?

I am trying to make my text area to print the same exact message i wrote in the text area(it’s always printed in one line only). i tried some techniques i gathered from watching and reading but none of them work, i’ve been trying to make it for 2 days already. I’m newbie to php hope you guys can help me, thank you in advance.

Here is my code:

<textarea name="comment" rows="5" cols="120" wrap="virtual" nl2br () ></textarea>
$commentVar = $_POST["comment"];
echo "Comment: <br>". $commentVar;

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Like Markus Zeller said, nl2br must be used in PHP to echo the POST input from the form:

$commentVar = $_POST["comment"]; 
echo "Comment:". nl2br($commentVar);
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading