php - Echo a XHTML tag -
when try echo of xthml tags inside php loop 1 echo's data mysql shows text in browser. i'm running xampp control panel apache , mysql tests.
code:
echo "<textarea readonly>"; while ($wiersz = mysql_fetch_array($sql_wynik_zapytania)) { echo " ".$wiersz['nick'].":\n"; echo $wiersz['koment']."\n"."<hr />"."\n"; } echo "</textarea>";
the results in browser:
nick: <hr /> nick: asdaa <hr /> pallluch: cccc
"a" "asdaa" "cccc" random texts added table in databse tests.
echo works fine <textarea>
, <hr>
doesn't seems to.
can help?
a textarea element can't contain other plain text.
you writing invalid html , browser trying recover treating <
character plain text instead of start of tag.
it looks aren't using textarea accept user input anyway (you've made readonly). don't use textarea element here. want use <pre>
instead.
Comments
Post a Comment