1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > php修改找不到数据类型 php – 在$_POST中找不到输入类型=图像值

php修改找不到数据类型 php – 在$_POST中找不到输入类型=图像值

时间:2019-08-15 17:27:16

相关推荐

php修改找不到数据类型 php – 在$_POST中找不到输入类型=图像值

只需使用

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"].

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。