Home > Backend Development > PHP Tutorial > php里面 button 怎么传值?

php里面 button 怎么传值?

WBOY
Release: 2016-06-23 14:17:33
Original
2866 people have browsed it

<input type="button" name="button" value="审核" style="width:80px; height:25px; cursor:pointer;" onMouseMove= "this.style.background= '#e1d4c7'" onMouseOut= "this.style.background= ''" onclick="window.location.href='gzd_manage_select_list.php?Gid=<?=$Gid;?>'" />
Copy after login

这个怎么传值onclick="window.location.href='gzd_manage_select_list.php?Gid='",onclick里面怎么把Gid=的只传到gzd_manage_select_list.php页面去啊,谢谢!


回复讨论(解决方案)

这不是已经传了吗?url带参数

echo $_GET['Gid'];

这不是已经传了吗?url带参数
没有啊,在gzd_manage_select_list.php页面没有得到值?

echo $_GET['Gid'];
这个是在gzd_manage_select_list.php页面写就会有值啦嘛,可是我这边却没有值啊?

当前页面 echo $Gid; 有值吗

<input type="button" name="button" value="审核" style="width:80px; height:25px; cursor:pointer;" onMouseMove= "this.style.background= '#e1d4c7'" onMouseOut= "this.style.background= ''" onclick="window.location.href='gzd_manage_select_list.php?Gid=<?echo $Gid;?>'" />
Copy after login



就是把'='改成'echo'

还是需要标签,用get或者post就可以了

gzd_manage_select_list.php 页面里写

if (!empty($_GET['Gid'])){     //如果 Gid 不为空  $Gid = $_GET['Gid'];         //设置变量$Gid 的值为传过来的Gid值  echo $Gid;                   //如果赋值成功,会有值输出}
Copy after login

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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template