检查功能不起作用!!请帮忙
- 第一次使用堆栈溢出。需要遵守帖子规则吗?link.php?screensize=xxx
<php?
function Check (){
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
if (!is_numeric($_POST["num1"]))
{
$Err1 = "Num1 is not numeric";
}
if (!is_numeric($_POST["num2"]))
{
$Err2 = "Num2 is not numeric";
}
if ( $Err1 = $Err2 = ""){
return true;}
else return false;
}
return false;
}
?>
答案 0 :(得分:0)
此代码用于检查num1和num2是否不是数字,如果num1除以0,如果未选择计算类型则返回
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
if (!is_numeric($_POST["num1"]))
{ echo "
<script type=\"text/javascript\">
history.go(-1);
</script>
";
}
elseif (!is_numeric($_POST["num2"]))
{
echo "
<script type=\"text/javascript\">
history.go(-1);
</script>
";
}
elseif ($_POST["num2"] == 0 && $_POST['rb1'] =="Divide")
{
echo "
<script type=\"text/javascript\">
history.go(-1);
</script>
";
}
elseif (! isset($_POST['rb1'])) {
echo "
<script type=\"text/javascript\">
history.go(-1);
</script>
";
}
}