有关页面重定向(header)的问题
ye169 2002-01-04 12:26:19 请问各位大侠,我想用header重定向另一个网页,为什么总是不能成功,提示为
Warning: Cannot add header information - headers already sent by (output started at C:\MYPHP\test\test1.php:1) in C:\MYPHP\test\test1.php on line 8
很简单的一个程序,内容如下:
<form action=<? print $PHP_SELF; ?> method=past>
用户名:<input type=text name=name size=20>
密码:<input type=password name=pass size=20>
<input type=submit value=确认>
</form>
<?
if($name="hawk"&&$pass="1978"){
header("location: test2.php");//就是这一行
}else{ print "error!"; }
?>
test2.php是同一目录下的文件,因程序仅是测试,所以无任何安全防范。