Re: Quotes """ in form textarea fields

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

 



> 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.

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux