转 学生管理类

看上去很工整。

 

<!DOCTYPE html>
<html>
<head>
<title>学生管理类</title>
</head>
<body>
<form method="post">
学号:<input type="text" name="number"><br/>
姓名:<input type="text" name="name"><br/>
性别:<input type="radio" name="sex" value="男" checked="checked">男
<input type="radio" name="sex" value="女">女<br/>
<input type="submit" name="ok" value="显示">
</form>
</body>
</html>
<?php
class student
{
private $number;
private $name;
private $sex;
function show($XH,$XM,$XB)
{
$this->number=$XH;
$this->name=$XM;
$this->sex=$XB;
echo "学号:".$this->number."<br/>";
echo "姓名:".$this->name."<br/>";
echo "性别:".$this->sex."<br/>";
}
}

if(isset($_POST['ok']))
{
$XH=$_POST['number'];
$XM=$_POST['name'];
$XB=$_POST['sex'];
$stu=new student;
$stu->show($XH,$XM,$XB);
}
?>

posted @ 2017-03-19 22:31  feiyun8616  阅读(168)  评论(0编辑  收藏  举报