Re: Quotes """ in form textarea fields

From: Date: Fri, 08 Oct 2004 15:14:19 +0000
Subject: Re: Quotes """ in form textarea fields
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-198976@lists.php.net to get a copy of this message
> A user enters in a textarea field of FORM1.php: > Bob is "high" > > Submitted to FROM2.php we get: > > Bob is \"high\" > Tha't's normal beacuse you have magic_quotes_gpc_on > In a hidden field in FROM2.php we store the value: <type="hidden", > value="<? > echo stripslashes($_POST['textarea']); ?>> Value now Bob is "high" > > Then from FROM2.php we Submit BACK to FROM1.php and enter it back into the > textarea field with: > <type="textarea", value="<? echo $_POST['hidden']); ?> > > we have; > Bob is > Well, you get that in the browser. But i'm sure that if you look to the page source, you will see something like <type="textarea" value="Bob is "High""> Because of that the atribute value will end at the first closeing quotes and will show only the string to that "closing" quotes. You can solve this by using the htmlspecialchars() or htmlentities() functions: $APParea1 = htmspecialchars(stripslashes($_POST['textarea'])); or can be done that other way: $APParea1 = htmlentities(stripslashes($_POST['textarea'])); Choose one or other function depending of your needs. Hope this helps. Regards, Jordi.

« previous php.general (#198976) next »