Re: inserting free-form text with quotes to mysql
| From: | Matthew Garman | Date: | Sat, 21 Jul 2001 19:35:42 +0000 |
| Subject: | Re: inserting free-form text with quotes to mysql | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-59031@lists.php.net to get a copy of this message | ||
Ahh yes, that was exactly what I needed. (I knew it was simple!)
But that brings up another question: whenever I have POST information
propagate over more than one page, is it generally a good idea to *always*
use htmlspecialchars () on my data?
I.e., even if the data shouldn't need htmlspecialchars () (numbers for
example), it seems like it wouldn't hurt to use that function just to make
sure nothing is lost.
Thanks again!
Matt
On Fri, Jul 20, 2001 at 02:18:09PM -0500, Brad S. Jackson wrote:
> And when you print the value back on the verification page, call
> htmlspecialchars() on the value.
>
> echo "<input type=\"text\" name=\"blah\" value=\"" .
> htmlspecialchars($blah) .
> "\">";
>
>> Whenever I try to submit text that contains a double quote character ("), the
>> submission gets truncated at the first occurance of a double quote and beyond.
>> Single quotes don't seem to be problematic.
--
Matt Garman, garman@uiuc.edu
"I'll tip my hat to the new constitution, Take a bow for the new revolution
Smile and grin at the change all around, Pick up my guitar and play
Just like yesterday, Then I'll get on my knees and pray..."
-- Pete Townshend/The Who, "Won't Get Fooled Again"