Re: Slashes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ng Hwee Hwee wrote:

> but why is it that I still get a backslash
> before an occurrence of a single-quote?

for example, <td width="630" height="6"><? echo $fieldName; ?></td>

where $fieldName is retrieved from the database through:

Maybe magic_quotes_runtime is enabled? It will add slashes to data from files and databases. Bottom line, if you actually see the slashes in your data, in your database, then you're adding the slashes twice, somehow.


for example:
<input type="text" name="field1" size="20" value="<? echo $fieldName; ?>">

if $fieldName contains: it's name is "Bob", anything after the double quote (i.e. Bob") gets cut-off! it's disaster!!

You must convert the double quote to &quot; which is an HTML entity. Run $fieldName through htmlentities() before you place it within the value attribute.


--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux