PHP 实现判断密码两次是否一致

来源:互联网 发布:网络歌手花姐 编辑:程序博客网 时间:2024/05/17 02:37
<?phpheader('content-type:text/html; charset=utf-8');//设置字符集?><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Insert title here</title><script>function on_submit(){var username=document.getElementById("username");var pwd=document.getElementById("upassword");var repwd=document.getElementById("repassword");if(pwd.value!=repwd.value){alert("两次密码不一致");pwd.value="";repwd.value="";pwd.focus();return false;}}</script></head></head><body><form action="" method="post" name="form2" id="form2" onsubmit="return on_submit()"><table width="614" align="center"><tr valign="baseline"><td nowrap="nowrap" align="right">用户名:</td><td><input name="username" type="text" value="" size="32"  /></td></tr><tr valign="baseline"><td nowrap="nowrap" align="right">密码:</td><td><input type="password" id="upassword" size="32"  /></td></tr><tr valign="baseline"><td nowrap="nowrap" align="right">重复密码:</td><td><input type="password" id="repassword" size="32"  /></td></tr><tr><td></td><td><input type="submit" value="确定" /></td></tr></table></form></body></html>