Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- sending param in _GET causes problems
August 27, 2007, 6:10 am
rate this thread
I'm generating an image with the GD lib.
As I need to send parameters to the image, this is my code :
$MyText = "this is my text" ;
<img src="MyImg.php?text=<?=$MyText ?>" ... />
In this case, there is no pb. I get the param with $_GET['text'] properly
Still, if I send the following text : $MyText = "a + b" ;
I doesn't work anymore... I guess the character '+' is the trouble.
How to do it ? Is it possible to send params via _POST ? How ?
Thanks in advance,
Re: sending param in _GET causes problems
The problem is, that you don't encode the text properly. If you send it
within an URL, you have to urlencode the text so it behaves properly.You
can use the urlencode function for doing this:
<img src="MyImg.php?text=<?=urlencode($MyText); ?>" .../>
insOMnia - We never sleep...