Re: short text strings with apostrophes and forms

From: Date: Thu, 20 Apr 2006 19:45:58 +0000
Subject: Re: short text strings with apostrophes and forms
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-41733@lists.php.net to get a copy of this message
dpgirago@mdanderson.org wrote:
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 Thanks, David. That did the trick. And thanks to everyone else who quickly responded with intelligent advice!
Jeffrey

« previous php.db (#41733) next »