Forum Moderators: open
I have a form that submits to a php script. I want to use image inputs instead of the usual submit button. On submission I want to test whether the image has been clicked (in my php script) to trigger other stuff. The problem I'm having is this:
In mozilla 1.0 and firefox, On clicking <input type="image" name="submit" value="1" src="whatever"> the following fields are posted to the server
submit.x=(x coordinate clicked on image)
submit.y=(y coordinate clicked on image)
submit=1
This is great cos I can test for submit=1 in my script.
The problem is in IE 6 (what a surprise). Clicking the image in IE seems to post:
submit.x=(x coordinate clicked on image)
submit.y=(y coordinate clicked on image)
Now I can't seem to successfully test for the existence of submit.x in php (presumably cos of the "."[smilestopper])
Any suggestions and I'd be really grateful. I really need this to work in IE.
Cheers
Nick
When you submit your form with a graphic button, you will notice the .x and .y appended to the name of the button.
...snertal&crew%5B%5D=gosny&formbutton.x=37&formbutton.y=14
But if you were to submit the page and look at the results, however, you'd see:
formbutton_x = 37
formbutton_y = 14
Notice that the period (.) has been converted to an underscore (_). This may seem a little odd, but it's necessary because variable names in PHP can't have periods in them, so $formbutton.x would be an illegal variable name. In fact, any periods in form names -- not just those for image buttons -- are converted to underscores.
Maybe others can add their 2 cents too.
By the way, it's better for you to put anything related to PHP in the PHP forum.