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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:32:47+00:00 2026-06-13T00:32:47+00:00

I have this code require_once(../Packages/Connection.php); $create_object = mysql_query(SELECT * FROM `Articles` WHERE `group` =

  • 0

I have this code

       require_once("../Packages/Connection.php");
       $create_object = mysql_query("SELECT * FROM `Articles` WHERE `group` = 'News' ORDER BY `id` DESC;");

      while($row=mysql_fetch_array($create_object))
        {
        $time = $row[time];
        $date = date("H:i M jS o ",$time);
        print "<form action='Update.php' method='post' float:left;>

                <input hidden='hidden' name='articleId' value='$row[id]'>

                <input hidden='hidden' name='method' value='update'>

                <textarea name='articleText' rows='3' cols='25'>$row[text]</textarea>
                <br />  
                <input type='submit' value=' Update '>
            </form><br />
            <form action='Update.php' method='post'>

                <input hidden='hidden' name='articleId' value='$row[id]'>

                <input hidden='hidden' name='method' value='delete'>

                <input type='submit' value=' Delete ' onClick='return confirmDelete()'float:left;'>

            </form>     
         <hr><br />";
         }  

And it outputs the text alright, it changes the new line to <br /> but every time I update, it adds a new, so first time I enter a text like:

Hi
My name is Jesper

it outputs Hi <br />
My name is Jesper to the database

and second time if i want to change something, like the name..
Hi <br /><br />
My name is JapSeyz

and it continues to add <br />'s.. how do I limit this to only one?

  • 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-13T00:32:49+00:00Added an answer on June 13, 2026 at 12:32 am

    That’s because you are using nl2br before storing the text to database. Go and see it there…

    The right way is to escape the data (e.g., nl2br) only when viewing. The data in the database should be clear, without any modifications regarding escaping for a particular purpose.

    In the <textarea> element, though, new-lines are already handled without need to insert <br> elements in there.

    So do not use nl2br when storing data and use it only when printing on a page (not in the form element).

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

Sidebar

Related Questions

Right now I have this code. <?php error_reporting(E_ALL); require_once('content_config.php'); function callback($buffer) { // replace
In one PHP file, I have this code: require_once $_SERVER['DOCUMENT_ROOT'] . '/custom/functions.php'; global $testVar;
I have this testing code in PAGE A : <?php require_once('../mysite/php/classes/eventManager.php'); $x=new EventManager(); $y=$x->loadNumbers();
i have this code... require_once facebook.php; $app_id = xxxxxx; $app_secret = xxxxx; $facebook =
I have this php code, no error is thrown but the data is not
I have this php code that is aimed for importing all rows and columns
So, I have xampp. I tested this code on ZendServer, result the same. <?php
I have this weird code on site. It gets all records (order by pozycja),
I have this code to connect to mysql and get data from one table
I have this code require 'mechanize' @agent = Mechanize.new page = @agent.get('http://something.com/?page=1') next_page =

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.