php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #8906 Image submit error with X and Y strings
Submitted: 2001-01-25 10:07 UTC Modified: 2001-01-25 10:15 UTC
From: menno at b10m dot net Assigned:
Status: Closed Package: Unknown/Other Function
PHP Version: 4.0.1pl2 OS: RedHat Linux 7.0
Private report: No CVE-ID: None
 [2001-01-25 10:07 UTC] menno at b10m dot net
When you have a form with a fieldname 'x' and/or 'y' and you put an image as submit button, instead of the usual submit button, PHP will add random numbers to it:

Small source code to reproduce this error:
-------------------------------------------------------
<?php
if(!$x && !$y && !$z) { $x="undefined"; $y=$x; $z=$x; }
print "X is: <strong>$x</strong><br>\n";
print "Y is: <strong>$y</strong><br>\n";
print "Z is: <strong>$z</strong><br>\n";
?>
<hr>
<form action="<?php echo $PHP_SELF;?>">
X: <input type="text" name="x" size="3"><br>
Y: <input type="text" name="y" size="3"><br>
Z: <input type="text" name="z" size="3"><br>
<br>
<input type="submit" value="search"><br>
<input type="image" src="search.jpg" alt="search">
</form>
-------------------------------------------------------

As you can see, the value's will be the same when you hit the original submit button, but the values will differ when you hit the image.

I have created a similar form in Perl (CGI), but that does not seem to have the same akward result.

Kind Regard,

-- 
M. J. Blom
menno@b10m.net

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-01-25 10:12 UTC] menno at b10m dot net
It seems that the added x and y values are the x and y coordinates of your mouse on the image *doh*. Kinda weird to use a default $x and $y for that though.

-- 
M. J. Blom
menno@b10m.net
 [2001-01-25 10:15 UTC] derick@php.net
This are not random numbers, this are the exact coordinates on the image where you clicked on it. Can you if this is the case?
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 04:01:27 2024 UTC