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 8902397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:36:08+00:00 2026-06-15T01:36:08+00:00

I am having issues with <BR /> tags appearing inside of a pre-populated textarea

  • 0

I am having issues with <BR /> tags appearing inside of a pre-populated textarea form (with no breaks obviously). So these break tags need to be converted to /n within the textarea. This prepopulated text is being retrieved via the URL which also appears to have the break tags within it as well.

Basically what is going on and what I need:

I am having to get a block of text from the previous page (which was originally pulled from the database) and load that block of text into a textarea field on the form submission page. The user then fills out the rest of the form fields and submits the form, this information is then stored into a specific table in the database.

In order to get the block of text to display properly on the first page, I had to use nl2br to get this section breaking properly on the page. Obviously, now it is outputting that text with breaks instead of new lines.

This means when you click on the link to populate the form on the next page, the link has break tags in it, which in turn gets displayed inside of the textarea field on the next page as well as in the URL.

I am confused on what I need to do to replace those <BR />‘s with /n again. It seems like I could use str_replace or preg_replace, but I have yet to find an example of how to use either of those in conjunction with something like:

<textarea rows="10" cols="50"><? if(isset($_GET['text-property'])){ echo $_GET['text-property']; }?></textarea>

Keep in mind that I am still in the process of learning PHP, so I really need specifics and preferably examples if at all possible.

Thanks!

  • 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-15T01:36:10+00:00Added an answer on June 15, 2026 at 1:36 am

    You need to use preg_replace,

    <textarea rows="10" cols="50"><? if(isset($_GET['text-property'])){ echo preg_replace('/<br[^>]*?>/si', '\n',$_GET['text-property']); }?></textarea>
    

    Demo

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

Sidebar

Related Questions

Im having issues vertically positioning text inside of a text input field in Firefox.
Having issues with dynamically creating <select> tags and then populating them with XML values.
I was wondering are there any issues with having ampersands in XML tags? Or
Are there any issues in having a large number (say 50) of script tags
Having some issues accessing my param tags from within actionscript. Essentially I have the
Just having a few issues submitting a login form via ajax, I am primarily
Having issues with Twitter Bootstrap responsive navigation. The best way to explain this is
Having issues referencing $(this) from within a the nested ajax 'success' function... I know
Am having issues with printing different sized PDF's using GhostScript (V9.05). The PDF in
Still having issues with this problem. Please help if you can. So I am

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.