Hi,
I am a very new to HTML, so please go easy on the explanations. I have tried searching the forum but unfortunately I didn't understanding much of what I read.
I have a PHP script that writes to a MySQL database. One particular row ('description') uses HTML, as I use fckeditor to create the content. fckeditor and the form I wrote posts the content to the database just fine using:
$description=htmlspecialchars($description,ENT_QUOTES);
When I browse the row using phpMyadmin the htmlspecialchars has worked perfectly. However, the problem I have is when I am trying to show the contents of 'description' on a webpage. I use the following:
<?php
$sql = "SELECT * FROM `jmnpevents`
WHERE startDate between '".date("Y-m-d")."' AND '".date("Y-m-d",mktime(0, 0, 0, date("m"), date("d")+$daysAhead, date("Y")))."'
ORDER BY startDate ASC";
$sql_result = mysql_query ($sql, $connection ) or die ('request "Could not execute SQL query" '.$sql);
while ($row = mysql_fetch_assoc($sql_result)) {
if ($row["description"]<>'') {
echo '<table class="calendar_list"><tr><td class="calendar_list_date">';
echo date("F j, Y",strtotime($row["startDate"])).' - <strong>';
echo nl2br(stripslashes(utf8_decode($row["name"]))).'</strong></td></tr>';
echo '<tr><td class="calendar_list_description">';
echo stripslashes(utf8_decode($row["description"])).'</td></tr></table><br /><br />';
};
};
?>
However, this only shows the content as HTML tags, rather then rendering it properly as HTML. Does anyone know what I can do to solve this problem. I presume that it is something to do with the decoding, but for the life of me the searches I have done have not shed any light.
Thanks in advance.
Neil