Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8125031
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T06:40:22+00:00 2026-06-06T06:40:22+00:00

I have created a form <form name=form1 method=post> <textarea rows=5 cols=20 name=ta1></textarea> <input type=submit

  • 0

I have 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 a 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 table

Now when i type something in textarea as formatted below

Rafee
Web Developer
XYZ Company
New York

When i press the submit button, same content with same formatting structure in stored / displayed in database table / textbox

But when i echo this value its displaying in single line without any format.
How can we achived this.

And i have added an image for better understanding

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T06:40:23+00:00Added an answer on June 6, 2026 at 6:40 am

    Use

    echo nl2br($res['ttta']);
    

    That will convert \n into the HTML tag <br />

    In HTML, visible line brakes requires the use of the HTML tag <br />, but in your PHP, the stored data is "Rafee\nWeb Developer\nXYZ Company\nNew York\n", so you need the function to turn "\n" into "<br />".

    Reference: http://php.net/manual/en/function.nl2br.php

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a PHP form which requires the user to select a postcode
I am using ASP.NET2.0. I have created a download form with some input fields
I have created a contact form that has a disabled submit button until all
I am new to php. I have created a form but I am unable
I have a problem with the PHP contact form I have created. When I
I have a popup with a form containing file upload cfgfile <form id=mainForm method=post
I have created a form that is used for both adding and editing a
I have created a form with a dropdown list for 'Region'. Once the form
I have created a form for my news articles which I then call to
I have created a form on which two components are present, button and progressbar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.