Home > php教程 > php手册 > php用图片代替submit按钮后提取不到submit的值

php用图片代替submit按钮后提取不到submit的值

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 10:42:51
Original
1259 people have browsed it

这里有两个问题:

1. 图片按钮与普通按钮不同,需要用js来模拟提交操作。

2. 在php中获取按钮操作时,采用正常的isset($_POST[object name])无法获取到,后经过print_r($_POST),发现产生了:

Array ( [btn_reg_x] => 81 [btn_reg_y] => 27 )

经查阅资料发现:

$_POST[thisname_x]   --鼠标点击图片的X位置
$_POST[thisname_y]   --鼠标点击图片的Y位置

因此,修改原客户端提交代码为:

function SubmitOne()
{
    $("MyForm").submit();
}

php代码改为:

if(isset($_POST[btn_reg_x])) // 或 (isset($_POST[btn_reg_y]))
{
      echo ok!Thats right.;
}

 

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template