Re: [PHP] TextArea vs. URLEncode/URLDecode/quotes

2003-07-09 Thread Kevin Stone

- Original Message -
From: Arcadius A. [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, July 09, 2003 12:50 PM
Subject: [PHP] TextArea vs. URLEncode/URLDecode/quotes

(snip)
 So, My question is: What's the best way to get the value of a textarea
back
 after validation without using session?

 Thanks.

 Arcadius Ahouansou.

Try htmlspecialchars() or htmlentities() to convert quotes and other non-url
friendly characters..
http://www.php.net/manual/en/function.htmlspecialchars.php
http://www.php.net/manual/en/function.htmlentities.php

- Kevin



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



Re: [PHP] TextArea vs. URLEncode/URLDecode/quotes

2003-07-09 Thread Marek Kilimajer
The correct way is:
In validate.php:
if(error) {
if(magic_quotes) stripslashes();
urlencode();
} else {
INSERT INTO ...
}
In form.php:
// urldecode() is not needed, GET variables are already decoded
if(magic_quotes) stripslashes();
textarea?= htmlspecialchars()?/textarea
Arcadius A. wrote:

Hello!
I have a form with a textarea...
When the user submits the form, I validate the form on another page.. and in
case the data are not valid,
 I redirect the user back to the form, passing all the info filled in
previously in the URL, then I easily display the values  in the form
again For textarea, I use :
urlencode($textarea_value)  to pass the text in the URL for the validating
page.
And in the textarea, to get back the info, I do:
 textarea?=urldecode($_GET['textarea_value'])?/textarea
This works fine as far as there is no quote in the text

In case there are quotes in the text, quotes are escaped :-( so I get in
the textarea slashes just before the quotes and stripslashes doesn't
seem to help...
So, My question is: What's the best way to get the value of a textarea back
after validation without using session?
Thanks.

Arcadius Ahouansou.





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


Re: [PHP] TextArea vs. URLEncode/URLDecode/quotes

2003-07-09 Thread Arcadius A.

Marek Kilimajer [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 The correct way is:
 In validate.php:
 if(error) {
 if(magic_quotes) stripslashes();
 urlencode();
 } else {
 INSERT INTO ...
 }

 In form.php:
 // urldecode() is not needed, GET variables are already decoded
 if(magic_quotes) stripslashes();
 textarea?= htmlspecialchars()?/textarea



Thanks!!! :-)



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