<center>
<h3>登录界面</h3>
<form action="#" id="form1" name="form1" method="post">
用户名:<input type="text" id="username" >
密 码:<input type="password" id="pwd"><br><br>
<input type="submit" name="submit" value="注册">
<input type="reset" name="reset" value="重置">
</form>
</center>
<?php
include_once ("conn.php");$username=$_POST["username"];
$pwd=$_POST["pwd"];
if ($username!="" && $pwd!="")
{
$pdo->exec("insert into user (username,pwd) values('".$username."','".$pwd."')");
echo "注册成功";
}
else
{
echo "用户名或者密码不能为空";
}
?>
<h3>登录界面</h3>
<form action="#" id="form1" name="form1" method="post">
用户名:<input type="text" id="username" >
密 码:<input type="password" id="pwd"><br><br>
<input type="submit" name="submit" value="注册">
<input type="reset" name="reset" value="重置">
</form>
</center>
<?php
include_once ("conn.php");$username=$_POST["username"];
$pwd=$_POST["pwd"];
if ($username!="" && $pwd!="")
{
$pdo->exec("insert into user (username,pwd) values('".$username."','".$pwd."')");
echo "注册成功";
}
else
{
echo "用户名或者密码不能为空";
}
?>
<h3>登录界面</h3>
<form action="#" id="form1" name="form1" method="post">
<!-- 这里要加上name属性,否则$_POST中没有对应的值 -->
用户名:<input type="text" id="username" name="username">
密 码:<input type="password" id="pwd" name="pwd"><br>
<br>
<input type="submit" name="submit" value="注册">
<input type="reset" name="reset" value="重置">
</form>
</center>
<?php
include_once ("conn.php");$username=$_POST["username"];
$pwd=$_POST["pwd"];
if ($username!="" && $pwd!=""){
$pdo->exec("insert into user (username,pwd) values('".$username."','".$pwd."')");
echo "注册成功";
} else {
echo "用户名或者密码不能为空";
}
?>