For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > April 2006 > Re: [PHP-DB] short text strings with apostrophes and forms









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PHP-DB] short text strings with apostrophes and forms
dpgirago@mdanderson.org

2006-04-20, 6:58 pm


> I have an application which calls up some data from a MySQL table and
> puts it into a web form for users to modify.
>
> One of the cells holds a text string which is put into a text input
> field. However, if that text string includes an apostrophe, all text
> after the apostrophe disappears.
>
> For example, if the test string from a database cell reads...
>
> Fix the managers' cars by Tuesday
>
> and that is saved in the variable $some_text, which is called up in a
> form...
>
> <input type='text' name='some_variable' value='$some_text'>
>
> The text field on the web page will only contain...
>
> Fix the managers
>
> How can I get the text field to show the entire string?
>
> Many thanks,
>
> Jeffrey



htmlentities($some_text, ENT_QUOTES) is more robust than htmlspecialchars
();

David
Jeffrey

2006-04-20, 6:58 pm

dpgirago@mdanderson.org wrote:
>
>
>
> htmlentities($some_text, ENT_QUOTES) is more robust than htmlspecialchars
> ();
>
> David
>
>

Thanks, David. That did the trick. And thanks to everyone else who
quickly responded with intelligent advice!

Jeffrey
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com