I have a problem with an HTML form. I have a form which I want to be able to
type basic HTML code into it. When the submit button is selected the data is
then previewed and added back into the text box again. Unfortunately all of
the " charachters are escaped (I think that is the correct term) ie they
have a leading \ added. This is causing me huge problems. I don't understand
why that is happening. Any ideas?
------------------CODE--------------
<?PHP
if(!isset($contents))
{
include "config.php";
mysql_connect($cfg['dbhost'], $cfg['dbuser'], $cfg['dbpasswd']);
$query = "SELECT `text` FROM `golf_contents` WHERE 1 AND `section`
LIKE '$section'";
$result = mysql_db_query($cfg['dbname'], $query);
if ($result)
{
while ($r = mysql_fetch_array($result))
{
$contents=$r["text"];
}
}
}
$output = "
<html>
<head>
<title>
Edit Text
</title>
</head>
<body>
<form method=\"POST\" action=\"edittext.php?section=$section\">
<textarea rows=\"10\" name=\"contents\" cols=\"35\">
$contents
</textarea>
<input type=\"submit\" value=\"Preview\" name=\"B1\">
<input type=\"reset\" value=\"Reset\" name=\"B2\">
</form>
<BR>Preview...<BR>
$contents
</body>
</html>
";
echo $output;
?>