PDA

View Full Version : Outputting forum/blog post



Jazza
19 Oct 2010, 03:19 AM
Hello all. I have a personal website (http://www.jazzaweb.com) I've been working on for a few months on and off, and I need some help with it.

I've created a blog system and guestbook for the project that stores in a MySQL database, the standard method, but I have issues with outputting the post information especially with specific symbols. I've been testing several php functions to make the symbols browser/server friendly, but with little success. Here is the current function I use to "sift" out the inputted string



//********************** Clean Var *********************//
// Clean out HTML, php and MySQL from input.
//
//******************************************************//

function tool_clean($input)
{
// $var=htmlspecialchars($var, ENT_QUOTES);
$input=stripslashes($input);
$input=strip_tags($input);
$input=mysql_real_escape_string($input);
return $input;
}

// Strip ' symbol in particular


The function is designed, as stated in the header, to clean input into the function and return the cleaned string. It's as basic as it looks. However I've been experimenting with several php functions (such as the commented one) to allow ' symbols and others like line breaks, etc.

Does someone have a simple piece of code that can convert a stored string (in it's raw form) into a friendly output (such as for a blog or forum). I've done a little research and as you can see, I've been experimenting as I always do, but help would be nice.

(You must get this kind of thing a lot, I'm guessing)

Many thanks.