I'm trying to create a form where I can type in a piece of news as I would normally type and include links in the form

<a href="www.google.com">google</a>

and have it preserve the formatting and display the link as a link when echoing back.

My problem is that despite a fair amount of trying the above link would be coming back as something like wwww.mywebsite.com/\"www.google.com"\ when I echo the db contents. My code is as follows:

$title= mysql_real_escape_string($_POST[title]);
	$description= mysql_real_escape_string($_POST[description]);
	$article= $_POST[article];

	$sql = "INSERT INTO news (title, description, article)			
			VALUES('$title' ,'$description','$article')";
		if(mysql_query($sql, $con))
			echo "<p>The news article was submitted. Return to the <a href='../news.php'>news</a> page";
			echo "Articles submission failed: " . mysql_error();

With the result echoing back by the following:

$result = mysql_query("SELECT * FROM news ORDER BY number DESC");

while($row = mysql_fetch_array($result))
	  echo "<h2>" . $row['title'] . "</h2>";
	  echo "<p>" . nl2br($row['article']) . "</p>";	  
	  echo '<br /><div class="gbutton"><g:plusone></g:plusone></div>';

Any help would be appreciated.


try to add slashes instead of real escape

$title= addslashes($_POST[title]);	
$description= addslashes($_POST[description]);