LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 890|回复: 1

请问一下:如何定义变量的使用范围

[复制链接]
发表于 2003-5-25 17:37:53 | 显示全部楼层 |阅读模式
我在一个前一个html或PHP中定义的变量如何用到后一个,甚至后几个PHP文件中啊?
比如:
//test.html
....
<form method=post action="test1.php">
....
<input type=text name="user_name">
....
</form>
...
//test1.php
...
<?
$link=@mysql_connect("","","");
$query="select * from test where user_name='$user_name'";
....
if (1)
{
header("location: test2.php");
}
?>
...
//test2.php
<?echo "username is :".$user_name?>//到这里时$user_name就不能使用了,怎么让上面的$user_name的
值传到这里呢?
先谢谢了!
发表于 2003-5-25 18:39:30 | 显示全部楼层
echo "<a href=\"test2.php?user_name=".$user_name."\">print user name</a><br />";
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表