skip to Main Content

I want to show the data which is stored in sql column like a package details of a tour. when i am calling that column it’s displaying details but it’s not showing in clean and neat way. It’s displaying like a only a single paragraph. So i added <br> tag where i need a newline. But it’s showing me that <br> tag in the website not a new line that’s fraustating. How should i give the strong tag and br tag to that data.

ex: <b> Day1 :</b> <br>To park vist and bar<br> <strong> Day 2: </strong> <br>

Above mentioned is the data saved in column.

Am Expecting that the line breaker should work and has to display one by one with strong tag impact.

2

Answers


  1. Welcome to Stack Overflow!

    To make it display bold and such, I suspect your only real solution is to use either Markdown (https://www.markdownguide.org) or a combination of HTML and CSS.

    When writing to the column in the database, either write it in Markdown format, and then use a Markdown parser on the front-end, or simply write your text to the column within HTML tags. Beware of security pitfalls though – always sanitize user inputs.

    If the data is already in the table (you’re simply reading from the table and not writing to it) I would recommend using a combination of https://www.php.net/manual/en/function.nl2br.php as well as some string tokenization of sorts.

    Login or Signup to reply.
  2. if you only want break line then use textarea and simply add data with enter and after getting the data from database
    perform the following operation.

    $mydata=nl2br($datafromdatabase);
    

    then just print it. It will add

    <br /> 
    

    after every line.
    But if you want to design the font size and font style or something else then use any editor for getting all options.
    you can use popular editor called CKEditor

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search