Reply to Re: preg_replace help?

Your name:

Reply:


Posted by Rik on 07/28/07 02:16

On Sat, 28 Jul 2007 04:11:02 +0200, Trammel <Me@Server.com> wrote:

> Im accepting user input from a text-box on a webpage.
> I am then wanting to echo that back into the same box when the page is=

> submitted.
>
> The problem I have is that the input COULD contain multiple quotes and=

> double-quotes.
> AddSlashes doesnt seem to work properly, as it turns ' into \'
> ...and " just into \ (removing everything after)

It doesn't, but you haven't shown your code and exact output, so I canno=
t =

tell you what the error there is.

> I thought of using single-quotes for the Value=3D'' and then use =

> preg_replace
> to replace all occurances of ' with \' ...but I cant figure-out how t=
o =

> do
> it.
>
> Anyone got any idea?
>
> For example the user might have entered: ''''"""'"'"''"' (A collectio=
n =

> of
> quotes & double-quotes)
> The input is stored in $myVar... and needs to be put BACK inside Value=
=3D''

If it's just HTML, use htmlspecialchars($myVar,ENT_QUOTES); On a submit =
of =

the form it will be the normal string again, so no worries there either.=

-- =

Rik Wasmus

[Back to original 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

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