replacing ampersand with character code
3 posts by 2 authors in: Forums > CMS Builder
Last Post: October 23, 2008 (RSS)
By Deborah - October 23, 2008
Is there a way to replace a typed ampersand "&" with "&" in a texfield or textbox field? My generated web page is displaying the unescaped ampersand, and therefore doesn't pass validation.
Another CMS I used had a "search and replace" option, which allowed for such replacements.
Thanks for any help.
Deborah
Another CMS I used had a "search and replace" option, which allowed for such replacements.
Thanks for any help.
Deborah
Re: [Deborah] replacing ampersand with character code
By Dave - October 23, 2008
Hi Deborah,
With wysiwyg fields it should be encoded automatically. For all other fields you can use the php htmlspecialchars() function in your viewer page. You can read more about this function here: http://www.php.net/htmlspecialchars
Just add the code in red:
<?php echo htmlspecialchars($record['title']) ?>
Hope that helps!
With wysiwyg fields it should be encoded automatically. For all other fields you can use the php htmlspecialchars() function in your viewer page. You can read more about this function here: http://www.php.net/htmlspecialchars
Just add the code in red:
<?php echo htmlspecialchars($record['title']) ?>
Hope that helps!
Dave Edis - Senior Developer
interactivetools.com
interactivetools.com
Re: [Dave] replacing ampersand with character code
By Deborah - October 23, 2008
Dave,
The code you supplied did the trick, and the link you provided to more info about the function was very informative.
Thanks for providing such excellent support... as you guys always do!
Deborah
The code you supplied did the trick, and the link you provided to more info about the function was very informative.
Thanks for providing such excellent support... as you guys always do!
Deborah