和登录页面一样通过html页面的表单来提交信息
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<form method="post" action="./server/doregister.php">
<input type="text" placeholder="用户名" name="username"><br><br>
<input type="password" placeholder="密码" name="password"><br><br>
<input type="password" placeholder="确认密码" name="repassword"><br><br>
<input type="text" placeholder="验证码" name="verifycode" class="captcha"><br><br>
<img id="captcha_img" src="./server/captcha.php?r=<?php echo rand();?>" alt="验证码">
<label><a href="javascript:void(0)" rel="external nofollow" onclick="document.getElementById('captcha_img').src='./server/captcha.php?r='+Math.random()">换一个</a> </label><br>
<button type="submit">注册</button>
</form>
</body>
</html>
在php后台里与登录不同的是增加一个插入的方法,以及去除自动保存改为判断两次密码是否相同。
页面展示:
js提示信息代码:
echo '<html><head><Script Language="JavaScript">alert("错误信息");</Script></head></html>' . "<meta http-equiv=\"refresh\" content=\"0;url=../"你的注册页面"\">";