Forum Moderators: coopster

Message Too Old, No Replies

Getting Coordinates From A Form Image

Cant get it to work :(

         

Angelis

12:16 pm on Feb 9, 2006 (gmt 0)

10+ Year Member



Hi I have a image on a page of one of my sites which has a large <input type="mage"> image on it.

When clicked the image goes to a PHP form and I then need to get the x & y values into a PHP form but I cannot get it to work.

The url looks like this: [site.ext...]

The form that contains the images method="GET" and so I was trying to pull the value of the coordinate using <?php $x = $_GET['coordinate.x'];?> but that doesnt seem to work, it basically returns no value.

I have also tried using explode to get the value but it returns nothing, I am guessing it has something to do with the fullstops in the URL.

If anyone has a solution they can tell me about please do so. If you need any more info than I have listed please ask me for what you need to help.

Thanks in advance everyone.

coopster

2:34 pm on Feb 9, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



You are close, it was just a misunderstanding of how that variable is returned. The dot (.) is converted to an underscore (_).

PHP and HTML [php.net]

Be careful though as the MSIE browser will not return [webmasterworld.com] what you may expect. Moz-based browsers will indeed send all three values back, the 'coordinate' value, the coordinate_x value and the coordinate_y value.

Angelis

2:39 pm on Feb 9, 2006 (gmt 0)

10+ Year Member



Thanks Coopster, you saved the day once again :)

Really wierd how that works but I guess once you know you never forget, someone should write something up to draw attencion to it, 4 people in our office all sat looking blindly at each other doesnt make us feel very good.

Ty

jatar_k

3:39 pm on Feb 9, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



for the future here's a tip

if you are passing vars to a script in an array, $_GET and $_POST are both arrays obviously, and you can't figure out what you are getting then do this

echo '<pre>';
print_r($_GET);
echo '</pre>';

that should have showed you where your problem was. It is the first thing I put in any script that is receiving get/post information. It helps me ensure that I am receiving what I am expecting before I start trying to do anything with it.