Home >Backend Development >PHP Tutorial > 超链接跳转事先执行函数

超链接跳转事先执行函数

WBOY
WBOYOriginal
2016-06-13 12:43:001357browse

超链接跳转之前执行函数
如题 
目的:点击一个超链接 onclick()函数为session赋值 然后跳转后的页面输出这个值
问题:为什么我的点击链接函数都没有执行 不管是让它返回false还是true session里面都赋不进去值,跳转后的页面一片空白
超链接页面代码

<br />
<body><br />
<?php <br />
				session_start();<br />
				function f1()<br />
				{<br />
				<br />
					$_SESSION['test']="wewew";<br />
					echo "wocaoeo";<br />
					return false;<br />
				}<br />
?><br />
  <a href="test.php"  onclick="return f1();">单击执行f1 </a><br />
</body><br />


要跳转到的页面代码
<br />
<?php <br />
session_start();<br />
echo $_SESSION['test'];<br />
	<br />
?><br />
 

PHP 超链接 函数
Statement:
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