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

  • Home
  • SEARCH
  • 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 6953565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:29:44+00:00 2026-05-27T14:29:44+00:00

I am having a problem with some textarea things. I insert text into my

  • 0

I am having a problem with some textarea things. I insert text into my database using a textarea like

<textarea id="e1" name="content"></textarea>

My php file then runs some stuff on it as shown to make HTML tags out of \n and \r:

$str     = $_POST['content'];
$order   = array("\r\n", "\n", "\r");
$replace = '<br />';
$content = mysql_real_escape_string(str_replace($order, $replace, $str));

and the result gets inserted into a database.
I then call the result from the database in $content and put that in a text area like so:

<textarea id="e1" name="content"><?php echo $content ?></textarea>

When I view that page the <br /> tags are visible.

An Example:

I submit this into the text area

Hello,
This is text.
Best Rergards,
Testificus

It gets processed by my php code and then is echoed into the textarea. When it is echoed into the textarea it comes out in the form:

Hello,<br />This is text.<br />Best Regards,<br />Testificus

Is there any way of having the text look like before with the <br /> tags in action rather that being presented as text? Thanks for your help and let me know if it is not clear what I mean.

  • 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-05-27T14:29:45+00:00Added an answer on May 27, 2026 at 2:29 pm

    Am I right, you want to replace the newlines with the <br /> tag? Why don’t you just use nl2br().

    If you want to keep using your example, you have to use:

    $replace = "<br />\r\n";

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

Sidebar

Related Questions

I'm having a problem using deploy:deploy-file with snapshots I'd like some advice on please.
I'm having some problem using multiple selectBooleanCheckBox in multiple DataTables in ui:repeat. Something like
I am having some problem in importing a .csv file into a sqlite table.
I'm having a problem with some code that used to work in PHP 4.X
For some reason I'm having a problem retrieving data from my database. It leaves
Hi I'm having some problem with a PHP page: I'm writing a little CMS
I am having some problem using the clone function in jQuery. I have been
I'm having a problem with some characters like 'í' or 'ñ' working in a
I'm having some problem with getting Python to handle my unicode text correctly. I've
I'm having some problem setting up an oauth provider with two-legged authentication. I'm using

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.