<html>
<body>
<?php
if(isset($HTTP_POST_VARS['submit']))
{
while(list($name, $value)=each($HTTP_POST_VARS))
echo "$name = $value\n";
}
else
{
?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
名: <input type="Text" name="first"></input>
姓: <input type="Text" name="last"></input>
住址:<input type="Text" name="address"></input>
职位:<input type="Text" name="position"></input>
<input type="Submit" name="submit" value="输入信息"></input>
</form>
<?php
}
?>
</body>
</html>
<body>
<?php
if(isset($HTTP_POST_VARS['submit']))
{
while(list($name, $value)=each($HTTP_POST_VARS))
echo "$name = $value\n";
}
else
{
?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
名: <input type="Text" name="first"></input>
姓: <input type="Text" name="last"></input>
住址:<input type="Text" name="address"></input>
职位:<input type="Text" name="position"></input>
<input type="Submit" name="submit" value="输入信息"></input>
</form>
<?php
}
?>
</body>
</html>
1:在处理变量时先检查一下是否存在(isset($HTTP_POST_VARS['submit']))
2:php本身页面的表示 $_SERVER['PHP_SELF']
不知道你是从哪里看来的