View Full Version : Using $_GET with dots in the URL
mlk
February 15th, 2006, 11:36 AM
Hello there, I've got a little problem (i'm sure the answer is easy, but google didn't help)
Using the following URL: http://127.0.0.1/test.php?image.x=23&image.y=12, how can I possibly get the x and y values of 'image' ?
I've tried $_GET['image'], $_GET['image.x'], $_GET['image']['x']... But can't seem to find the answer, it mostly answers
Notice: Undefined index: t in...
thanks for your help !
mlk
bwh2
February 15th, 2006, 12:26 PM
why don't you just change the names of your variables?
antizip
February 15th, 2006, 12:35 PM
it's not the name of the variable ... its an image button, it returns w/ x-y coordinates of the click. I had this problem too a while back, can't think of what i did. Let me try to find my stuff and i'll get back to ya.
[edit]
what you do is use _x ...
$_GET['image_x'];
Since (.) periods are illegal in varialbe names in php, it converts 'em to (_) underscores
mlk
February 15th, 2006, 01:03 PM
wow thanks !
If we could give out points to useful people, I'd give you a lot of them ! (and then you could hopefully exchange them to buy some cool geek gear on ebay or such)
antizip
February 15th, 2006, 01:44 PM
too bad i'm not a geek ...
And Also a quick note on the subject:
If you pass a variable with a space in the name ... it also gets converted into an underscore.
SlowRoasted
February 15th, 2006, 04:49 PM
cool, I knew about the space conversion but not the period. Useful info antisip:P
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.