Jump to content

Inserting a paragraph tag


Peggy

Recommended Posts

OK I know this is a simple question. So please bear with me. I have built an administration end on a web site.

Scenario:

• The administrator is enters data that is more than one paragraph.

• Data goes into the database.

• Then when I display that data on the web I want to insert “<p></p>” at the same place the administrator started the new paragraph.

I know this should be easy. I looked for “\r” or “\n” in the data in the data base but there was none.

I tried the code below but it isn't reliable. Besides I realize that this is just a work around and there is a better more “conventional” way.

 

 

$par_one  = $row[$category . '_par_one'];

$pattern = '/[[:space:]]{5,}/';

$category_par_one  =  preg_replace($pattern, '</p><p>', $par_one );

 

Link to comment
https://forums.phpfreaks.com/topic/169537-inserting-a-paragraph-tag/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.