一个简单的PHP例子

index.html :

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=gb2312" />
</head>
<body>
<form action="login.php" method="get">
name:<input type="text" name="user"><br />
password:<input type="password" name="passwd"><br />
<input type="submit" value="提交">
</form>
</body>
</html>

login.php :


<?
$user = $_GET["user"];
$passwd = $_GET["passwd"];

if($user=="ren" && $passwd=="ren"){
echo "*******************<br/>";
echo "welcome ".$user." !<br/>";
echo "*******************<br/>";

}else{
echo "*******************<br/>";
echo "\rlogin error! <br>";
echo "用户名: ".$user."<br/>";
echo "密码: ".$passwd."<br/>";
echo "*******************<br/>";

}
?>

你可能感兴趣的:(html,PHP)