表单文件form.htm部分代码如下:
<script lanaguage="javascript">
function go()
{
form1.action="direct.php";
form1.submit();
}
</script>
<form name="form1" method="post">
<select name="date" onChange="go()">
<option value="2003-9.htm" selected>2003年9月</option>
<option value="2003-10.htm">2003年10月</option>
<option value="2003-11.htm">2003年11月</option>
</select>
</form>
接受表单文件direct.php如下"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
<?
if(isset($date)){
header("Location: $date");
}
else
{echo "helloworld";}
?>
</body>
</html>
但是direct.php怎么都输出"helloworld",也就是$date没有东西
怎么回事呀?
thanks
<?
if(isset($_POST[date])){
header("Location: {$_POST[date]}");
}
else
{echo "helloworld";}
?>
把 <? 前的所有内容去掉,即以下内容:
------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
-------------------------------
把 <? 前的所有内容去掉,即以下内容:
------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
-------------------------------