Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

php and method GET

Status
Not open for further replies.

cmancre

Programmer
Jan 30, 2005
35
PT

i got this code in PHP:
echo "x".$_GET["var"]."x"; <-- in the html appears as "xx"

then a call for a page with this
...page.php&var=<? echo $_GET["var"]; ?>

in the target page i see in the url ....var=%20%20%20%20%20
and when the variable var contains something it shows the variable plus that numbers.

Solutions?
 
Solution would be to use the trim() function. %20 stands for space, and trim will get rid of space. However it does pose a question as to what are you doing with this. Why are you appending $_GET variable if there's nothing in it? Can we see the url where you grab that variable from?
 
...page.php&var=<? echo $_GET["var"]; ?> ?????

...page.php?var=something

surely, please tell me you are mad trying to execute php code passed using GET.

______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top