如何从具有自动换行符的textarea插入

I want to create a post system on my site.

The source is an HTML textarea value, which is inserted in a MySQL database and displayed like this:

<div align='center' style='background-color: #FFFFFF;text-align:left;width: 500px;padding: 10px;border-top: 5px solid #F45144;'>
<center><h1 style='color:#F45144;margin-top: -10;'>$Title</h1></center>
<p>
$Post
</div>
<br>
<style>br{line-height: 600%;}</style>

But The text isn't formatted correctly. (The "$Title" and "$Post" are 2 variables from database)

Look at the images: When I insert a post like this: enter image description here

I get this: enter image description here

When I insert a post like: enter image description here

The results are like: enter image description here

I want to insert like in img1 and get a result like in img4. (without the need to insert a <br>)

Because you need to convert the text's newlines to the <br /> tag, you can achieve this by using the nl2br() function:

echo nl2br($text);