只需使用
var_dump()来查看$_POST中的内容:
var_dump($_POST);
您会看到,当您使用< input type =“image”>提交表单时,您会得到:
array
'buyuka_x' => string '0' (length=1)
'buyuka_y' => string '0' (length=1)
所以,没有$_POST [‘buyuka’] – 相反,有:
> $_POST [‘buyuka_x’]
>和$_POST [‘buyuka_y’]
这意味着你的代码应该是这样的(不测试不存在的buyuka条目,并测试两个_x和_y – 我想测试其中一个就足够了):
if(isset($_POST['buyuka_x'], $_POST['buyuka_y']))
{
$sorgu='SELECT * FROM urunler ORDER BY uyeno DESC';
}
评论后编辑:我不知道为什么会这样 – 但是.x和.y是HTML标准中的定义.
如果您看一下Forms in HTML documents,向下滚动一下,您将能够阅读:
When a pointing device is used to
click on the image, the form is
submitted and the click coordinates
passed to the server.
The x value
is measured in pixels from the left of
the image, and the y value in pixels
from the top of the image.
The
submitted data includes
name.x=x-value and name.y=y-value
where “name” is the value of the name
attribute, and x-value and y-value are
the x and y coordinate values,
respectively.
在PHP中,参数名称中的点自动替换为unerscore.
所以:
> name.x成为name_x
>和name.y成为name_y
作为最后一个语句的来源,您可以阅读变量From External Sources – HTML Forms (GET and POST)(引用):
Dots and spaces in variable names are
converted to underscores.
For
example becomes
$_REQUEST["a_b"].