关于PHP函数声明与调用的一个小疑点

WBOY
Release: 2016-06-13 11:05:58
Original
690 people have browsed it

关于PHP函数声明与调用的一个小问题
我想通过点击按钮再调用执行这个函数,请问在怎么写啊,为什么及时不写onclick="return check()跳转过来他直接就执行了啊

<br /><html><br /><body><br /><button type="button" onclick="return check()"><br /><?<br />function check()<br />{<br />if($name==$_SESSION['username']||$name=="0000")<br />	{<br />	$sql= "DELETE FROM lostMsg WHERE msgID = '$msgID'";<br />    $result= mysql_query($sql1,$conn);<br />	if($result==true)<br />		{<br />		echo"<script>window.alert('删除成功!')</script>";<br />		echo "<script>window.location.href='xunwu_More.php'</script>";<br />		}<br />	}<br />	else<br />		echo"<script>window.alert('你不具备此权限!')</script>";<br />}<br />?><br /></body><br /><html>
Copy after login




------解决方案--------------------
onclick 是在客户端执行。
你的需求 要post/get到服务端,或者ajax才能实现。
------解决方案--------------------
">关于PHP函数声明与调用的一个小疑点

Related labels:
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!