Ex: The data in my DB field is: My name is <b>Adam</b>. When I retrieve the field and echo it to the screen, it still says: My name is <b>Adam</b> instead of Adam being in bold. Below is my code. Thanks in advance for any help or time spent.
Code: Select all
if(isset($_POST['profile'])){
$content = $_POST['content'];
// Starts the BBcode.
$bbcode = array("[u]", "[U]", "[/u]", "[/U]", "[i]", "[I]", "[/i]", "[/I]", "[b]", "[B]", "[/b]", "[/B]", ":)", ":(" , ":D", ":p"); // separate with commas.
$newbbcode = array("<u>", "<U>", "</u>", "</U>", "<i>", "<I>", "</i>", "</I>", "<b>", "<B>", "</b>", "</B>", "<img src=\"images/smile.gif\">", "<img src=\"images/frown.gif\">", "<img src=\"images/big-smile.gif\">", "<img src=\"images/tongue.gif\">");
$content = str_replace($bbcode, $newbbcode, $content);
// to block more words just add them in quotes and seperate with commas.
$badWords = array("<?php", "<?PHP", "?>");
foreach($badWords AS $v) {
// Replaces the words to nothing.
$content = addslashes(str_replace($v, "", $content));
$title = str_replace($v, "", $content);
}
if(empty($content)){
echo "<table width=60% class='failed' align='center'>";
echo "<tr><td align='center'>You forgot to put text in your Personal Profile!</td></tr>";
echo "</table>";
}else{
$newPassword = md5($new1);
$uUpdate = mysql_query("UPDATE user SET uProfile = '$content' WHERE uUsername = '$username'");
echo "<table width=60% class='success' align='center'>";
echo "<tr><td align='center'>Personal profile updated successfully!</td></tr>";
echo "</table>";
}
}
$profileQuery = mysql_query("SELECT uProfile FROM user WHERE uUsername = '$username'");
$profileRow = mysql_fetch_array($profileQuery);
?>
<form action="<?= $_SERVER['PHP_SELF'] ?>" method="POST">
<table width = 60% cellpadding=5 cellspacing=0 class='outline' align='center'>
<tr class='header'><td colspan=3 align='left'>Personal Profile</td></tr>
<tr class = 'detail_color'>
<td align='center' width = 60% colspan=3><textarea name="content" style="width: 95%;height: 200px;"><? echo stripslashes($profileRow['uProfile']); ?></textarea></td>
</tr>
<tr class = 'detail_color'>
<td align='center' width = 20% colspan=3><input type="submit" style="width: 95%;" name='profile' value="Save Profile"></td>
</tr>
</table>
</form>