以下是一个登记程序:如果输入了空白认证码时,会弹出讯息
当页面是utf8,gb2312时,便会重复2次弹出讯息
只有用big5,只弹出一次
Firefox沒有問題,只出一次, ie便出了2次请问如何解决?谢谢<?php
function alertMessage($msg){
echo "<script>alert('".$msg."');</script>";
}if(isset($_POST['signup'])){
if($_POST['validcode']!=""){
if($_POST['validcode']!=$_SESSION['checkkey']){
alertMessage('wrong code');
}
}
else{
alertMessage('code is null');
}
}//isset
?>
<html>
<body>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>signup</title>
<script type="text/javascript">
function signupSubmit(){
//alert(document.signupform.signuptype.name);
if(document.signupform.signuptype.checked==true){
if(document.signupform.username.value==""){
alert("plesae input the username");
return false;
}
}
return true;
}
</script>
</head> <form action="" method="post" name="signupform" onSubmit="return signupSubmit();">
<p><input type="checkbox" name="accept"> Accept</p>
<p><input type="text" name="validcode" size="5" maxlength="4"> <img src="validcode.php"></p>
<p><input type="submit" name="signup" value="signup" class="button"></p>
</form>
</body>
</html>
当页面是utf8,gb2312时,便会重复2次弹出讯息
只有用big5,只弹出一次
Firefox沒有問題,只出一次, ie便出了2次请问如何解决?谢谢<?php
function alertMessage($msg){
echo "<script>alert('".$msg."');</script>";
}if(isset($_POST['signup'])){
if($_POST['validcode']!=""){
if($_POST['validcode']!=$_SESSION['checkkey']){
alertMessage('wrong code');
}
}
else{
alertMessage('code is null');
}
}//isset
?>
<html>
<body>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>signup</title>
<script type="text/javascript">
function signupSubmit(){
//alert(document.signupform.signuptype.name);
if(document.signupform.signuptype.checked==true){
if(document.signupform.username.value==""){
alert("plesae input the username");
return false;
}
}
return true;
}
</script>
</head> <form action="" method="post" name="signupform" onSubmit="return signupSubmit();">
<p><input type="checkbox" name="accept"> Accept</p>
<p><input type="text" name="validcode" size="5" maxlength="4"> <img src="validcode.php"></p>
<p><input type="submit" name="signup" value="signup" class="button"></p>
</form>
</body>
</html>
是否这里出错?谢谢
if(isset($_POST['signup']))
<?php
$msg = "hello";
?>
<html>
<body>
..........
<script type="text/javascript">
<?php if(isset($msg)) echo "alert('".$msg."')";?>
</script>
</body>
</html>
还有其他方法吗?