Hello thr
My name is Jd..and well today was my first day at job and i was assigned a task in PHP..Im not actually a PHP Programmer but have done the basics like DataBase connectivity...The problem i am facing is that first i had to save and retrieve data completly formatted like the carrige returns and stuff i did it but when i show it in a TEXTAREA it includes the <br/> n stuff i don wan it to show the actual tags...i used the htmlspecialchars as well but no use can any body temme wat to do???
$result = mysql_query("SELECT * from newsTable",$db);
while($myrow = mysql_fetch_array($result))
{
$myrow["comments"] = htmlspecialchars($myrow["comments"]);
$myrow["comments"] = nl2br($myrow["comments"]);
echo "Comment Start";
echo "<textarea rows=2 name=comments cols=20>".$myrow["comments"];
echo "</textarea>";
echo "<br>Comment End <br>";
}?>
Problem text formatting in TEXTAREA
Moderator: General Moderators
try this
that will solve your , <br/> problems. But im not sure what other tags you have in there.
you may want to have a look at strip_tags() - http://se.php.net/manual/en/function.strip-tags.php
Could you post on example of what appears in the text box?
Mark
Code: Select all
$myrow['comments'] = ereg_replace ("(<br />|<br/>)","", $myrow['comments']);you may want to have a look at strip_tags() - http://se.php.net/manual/en/function.strip-tags.php
Could you post on example of what appears in the text box?
Mark