Re: Grrr quotes

From: Date: Wed, 10 Apr 2002 13:33:26 +0000
Subject: Re: Grrr quotes
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-18381@lists.php.net to get a copy of this message
htmlentities is producing all these signs ... :) i'd not use them to store the data in the database, a addslashes should be enough use htmlentities after having extracted the data from the db again... >>I do this with code before into database: >>------------------------------------------------------------ $beschrijving = addslashes($beschrijving); >>this piece of code is in the form (the <br> will be pulled out first) >>-------------------------------------------------------------------------- -- ------------------- <? $beschrijving = htmlentities(stripslashes($beschrijving)); <textarea name="beschrijving" rows="10" cols="50"><? echo $beschrijving ?></textarea> and if you want to get rid of the newline characters: >>I do this with code before into database: >>------------------------------------------------------------ $beschrijving = addslashes(str_replace("\n", "", $beschrijving)); anyone tell me in case i'm wrong *gg* :) Tomy Wagner ----- Original Message ----- From: "Marij Bellen" <Marij.Bellen@centric.nl> To: "Php-Db@Lists. Php.Net (E-mail)" <php-db@lists.php.net> Cc: <marijbellen@hotmail.com> Sent: Wednesday, April 10, 2002 1:00 PM Subject: [PHP-DB] Grrr quotes > Hello, i have a little problem with quotes: > > - first a have a textarea in a form > - second i'm gonna check this textarea > - if all checks sussesfull I process the data, so no straings thing get in > my database or whatever (function see below) > > Problem: if I get the data out of the database I sometimes get problems that > make funny '&' characters of quotes and if im wright also from alt-keys > (like for example a euro-sign ). > > EUR -> &#8364; > > I do this with code before into database: > ------------------------------------------------------------ > $beschrijving = ereg_replace("\n","<br>", > ereg_replace("`"," > ",htmlentities("$beschrijving"))); > > > this piece of code is in the form (the <br> will be pulled out first) > -------------------------------------------------------------------------- -- > ------------------- > <? $beschrijving = ereg_replace("<br>", "", $beschrijving); ?> > <textarea name="beschrijving" rows="10" cols="50"><? > echo $beschrijving > ?></textarea> > > > How is it possible i get these funny &-signs. > I think it has something to do with the htmlentities() i'm using. > Is there a way to translate them back or something? > > Thanks > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.db (#18381) next »