Display textarea format for echo from database
I created a form
<form name="form1" method="post"> <textarea rows="5" cols="20" name="ta1"></textarea> <input type="submit" name="submit" /> <textarea rows="5" cols="20"><?php echo $_POST['ta1']; ?></textarea> </form> And php code
<?php if ($_POST['submit']) { $llo = $_POST['ta1']; $con1 = mysql_connect("localhost", "FreeUser", "123456"); mysql_select_db("database", $con1); mysql_query("insert into test (ttta) values ('$llo')"); $q1 = mysql_query("select * from test"); $res = mysql_fetch_array($q1); echo $res['ttta']; } ?> Database table test
id Auto_Increment ttta mediumtext 500 only two fields in the table
Now that I will print something in textarea as formatted below
Rafee Web Developer XYZ Company New York When I click the submit button, the same content with the same formatting structure is stored / displayed in the database table / text box
But when I echo this value is displayed on one line without any format. How can we achieve this.
And I added an image for a better understanding.

+4
1 answer