note 535 deleted from function.htmlspecialchars by didou
| From: | didou@php.net | Date: | Tue, 29 Jul 2003 19:19:28 +0000 |
| Subject: | note 535 deleted from function.htmlspecialchars by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-52963@lists.php.net to get a copy of this message | ||
Note Submitter: aulbach@unter.franken.de
----
*This is the corrected version (the manual notes is a fine thing, but the corrections are difficult
:-( )*
<P>
This function is also very important for forms containing HTML-code. A web-based HTML-editor can
look like this:
<PRE>
<FORM ACTION=bla>
<H2>Restaurant Description<H2>
Name of restaurant:
<INPUT TYPE=text NAME="restname"
VALUE="<?
echo HTMLSpecialChars($restname); ?>">
<!-- here it is important to escape the quote char (").
Every browser will get cracy, if you want to edit a string like
$restname="\"The White Horse\""; -->
<BR>
Input description (you can use HTML - if you can): <BR>
<TEXTAREA NAME="descript"><?
echo HTMLSpecialChars($descript);
?></TEXTAREA>
<INPUT TYPE=submit>
</FORM>
</PRE>
Note, that the TEXTAREA includes <B>NO extra space, no newline or anything else</B>. If
you do not so, you have programmed a HTML memory leak. :-) The $descript-string is growing between
every submit and sends it back to the browser
and the browser will add new chars, cause your
TEXTAREA has told this to him.