<?
session_start();
if($_POST['cmd']=="go"){
$name=$_POST['name'];
$_SESSION['name']=$name;
header("Location:sss.php");
}
?>
<head></head>
<body>
<table>
<form action="test.php" method="post">
<input type="hidden" name="cmd" value="go" />
<tr>
<td><input type="text" name="name" /></td>
</tr>
<tr>
<td><input type="submit" name="tj" /></td>
</tr>
</form>
</table>
</body>
</html>首先。你要指明method方式。你为空的话默认为get方式.所以你post是取不到值的。

解决方案 »

  1.   

    因为你在给SESSION的变量赋值时,就赋了NULL值,所以就没有。原因,楼上讲的很明白,在你提交表单的时候,默认提交GET,所以你用POST方法获取不到值,你就误认为是Meta跳转没有SESSION。解决方法,楼上贴个代码,是正确的。