Jump to content

Insert html tags?


kelly123

Recommended Posts

I'm working on a journal that uses a php form to update the content. I was wondering if there was anyway to auto insert html tags into it to format it, or will I just have to add all the tags up when i write the update?

 

If you need clarification of what i mean, let me know.

 

 

Thanks in advance

 

http://www.infysolutions.com

 

--------------------------------------------------------------------------------------------------------

<a href="http://www.infysolutions.com">Outsourcing software development</a>

Link to comment
https://forums.phpfreaks.com/topic/125451-insert-html-tags/
Share on other sites

Here is a function I use for replacing new line breaks with p tags.

 

Perhaps you could expand on this.

 

function nl2p($text){

// Return if there are no line breaks.
if (!strstr($text, "\n")) {
	return $text;
}
// put all text into <p> tags
$text = '<p>'.$text.'</p>';
// replace all newline characters with paragraph
// ending and starting tags
$text = str_replace("\n", "</p>\n<p>", $text);
// remove empty paragraph tags & any cariage return characters
$text = str_replace(array('<p></p>', "\r" ,"\n"), '', $text);
$text = trim($text);
return $text;
} // end nl2p

Link to comment
https://forums.phpfreaks.com/topic/125451-insert-html-tags/#findComment-648563
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.