<html>
<head>
<title>提交数据</title>
</head>
<body>
<form action="index.php" method="post"> <!-- index.php,和文件同名 -->
<input type="text" name="StudentName" size="20" maxlength="40" value="">
<br/>
<input type="submit" name="submit" value="在网页上显示数据">
</form>
</body>
</html>
<?php
if(isset($_POST['submit']))
{
$name = $_POST['StudentName']; //表示用$_POST变量获取表单中的数据
echo $name;
}
?>