I've created a search form and wanted and want to use a graphic for the submit button, rather than the 'normal submit button'. I've got it to work ok but for some reason I seem to be passing two unwanted variables which I don't want - and don't know where they come from!
I checked out a few other sites which uses graphics for submit buttons and the same thing happens. The two variables are x & y and there values seem to change at will.
Whats going on and how can I stop these variables being passed?
Heres an example of the sort of thing thats happening - seems very strange!!!!!
That is because that is how HTTP sends inputs of type image the x and y stand for where the user clicked on the image starting at 0,0 from the upper left hand corner of the image. so if you had this in your form
<input type="image" name="image" src="blah.gif">
And the user clicked it then $image.x and $image.y or $image_x and $image_y will get passed on. If you are checking for if ($image) it won't work since the name attribute doesn't get passed with this type of input only the x and y coordinates get passed. Does that help?
Is this just how PHP acts or doesn't matter what script?
And I don't think you can access to $image.x ==> parse error
But $image_x will work just fine, I don't know why! :)
I didn't think that $image.x worked but in the example link given in an earlier post I saw it that way in the query string, I have always used _x and _y which it turns out thanks to Son is the correct way. It is not a PHP thing it is an HHTP thing.
But why posting through a Perl script, I don't see that encoded in the URL (GET method)?
Its kinda weird like that what I have found in php at least if you use the get method with a form with an image input like
<input type="image" name="submit" src="images/titles/logo.gif">
After clicking it you will see
Of course the numbers will change according to where you click the image. IN php you cannot have a variable name with a . in it so if you use _x and _y it somehow magically knows that it is actually .x and .y try it for yourself. Make a form that submits to itself with an image input watch the query string in the location bar of your browser. Then try printing those variables in PHP using _ instead .
Maybe PERL parses the vars differently but it is all in the POST or GET and it shouldn't matter which scripting langugae you use because the GET and POST strings are the same for all.