You are here: Re: Displaying " in a form text box « PHP Programming Language « IT news, forums, messages
Re: Displaying " in a form text box

Posted by Rik on 06/26/06 14:42

monomaniac21 wrote:
> Hi all ive added a form to a script using php and the form is to hold
> sizes of a product which means the client needs to be able to use " to
> denote inches. However when this is entered and the form submitted it
> makes it into the table and then displays as text on the page but not
> inside the form as its value. Is there a way around this?

htmlspecialchars($string);

Among others, it will replace '"' with '"'

> Ive tried replacing " with ' and a ' together but can't get this to
> work in the str_replace funtion example: str_replace('"', '''',
> $string); and help would be greatly appeciated!


Ugly solution, but here;s how it would work:
str_replace('"', '\'\'',$string);
or
str_replace('"', "''",$string);

Grtz,
--
Rik Wasmus

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация