kelly123 Posted September 23, 2008 Share Posted September 23, 2008 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> Quote Link to comment https://forums.phpfreaks.com/topic/125451-insert-html-tags/ Share on other sites More sharing options...
harristweed Posted September 23, 2008 Share Posted September 23, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/125451-insert-html-tags/#findComment-648563 Share on other sites More sharing options...
radalin Posted September 23, 2008 Share Posted September 23, 2008 How about using something like fckeditor or tinymce. They are rich text editors and they allow you to enter all king of html codes just like an office software. Quote Link to comment https://forums.phpfreaks.com/topic/125451-insert-html-tags/#findComment-648604 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.