以这种形式,这是我的代码:
<?php
// define variables and set to empty values
$number31=2.000;
$number32=493;
$number33=160;
$number34=333;
$number35=1.667;
$number36=1.667;
$number37=467;
$number38=133;
$number39=333;
$number40=1.333;
$number41=1.333;
$number42=440;
$number43=107;
$number44=333;
$number45=1.000;
$number46=1.000;
$number47=413;
$number48=80;
$number49=333;
$number50=667;
$number51=667;
$number52=387;
$number53=53;
$number54=333;
$number55=333;
$number56=333;
$number57=360;
$number58=27;
$number59=333;
$number60=0;
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$number31 = test_input($_POST[""]);
switch ($number31) {
case 2.000:
print "<h2>complete all the table!</h2>";
echo "<p>2.000, correct|";
break;
}
$number32 = test_input($_POST[""]);
switch ($number32) {
case 493:
echo "|493, correct|";
break;
}
$number33 = test_input($_POST[""]);
switch ($number33) {
case 160:
echo "|160, correct|";
break;
}
$number34 = test_input($_POST[""]);
switch ($number34) {
case 333:
echo "|333, correct|";
break;
}
$number35 = test_input($_POST[""]);
switch ($number35) {
case 1.667:
echo "|1.667, correct</p>-|";
break;
}
$number36 = test_input($_POST[""]);
switch ($number36) {
case 1.667:
echo "|-<p>1.667, correct|";
break;
}
$number37 = test_input($_POST[""]);
switch ($number37) {
case 467:
echo "|467, correct|";
break;
}
$number38 = test_input($_POST[""]);
switch ($number38) {
case 133:
echo "|133, correct|";
break;
}
$number39 = test_input($_POST[""]);
switch ($number39) {
case 333:
echo "|333, correct|";
break;
}
$number40 = test_input($_POST[""]);
switch ($number40) {
case 1.333:
echo "|1.333, correct</p>-|";
break;
}
$number41 = test_input($_POST[""]);
switch ($number41) {
case 1.333:
echo "|-<p>1.333, correct|";
break;
}
$number42 = test_input($_POST[""]);
switch ($number42) {
case 440:
echo "|440, correct|";
break;
}
$number43 = test_input($_POST[""]);
switch ($number43) {
case 107:
echo "|107, correct|";
break;
}
$number44 = test_input($_POST[""]);
switch ($number44) {
case 333:
echo "|333, correct|";
break;
}
$number45 = test_input($_POST[""]);
switch ($number45) {
case 1.000:
echo "|1.000, correct</p>-|";
break;
}
$number46 = test_input($_POST[""]);
switch ($number46) {
case 1.000:
echo "|-<p>1.000, correct|";
break;
}
$number47 = test_input($_POST[""]);
switch ($number47) {
case 413:
echo "|413, correct|";
break;
}
$number48 = test_input($_POST[""]);
switch ($number48) {
case 80:
echo "|80, correct|";
break;
}
$number49 = test_input($_POST[""]);
switch ($number49) {
case 333:
echo "|333, correct|";
break;
}
$number50 = test_input($_POST[""]);
switch ($number50) {
case 667:
echo "|667, correct</p>|";
break;
}
$number51 = test_input($_POST[""]);
switch ($number51) {
case 667:
echo "|<p>667, correct|";
break;
}
$number52 = test_input($_POST[""]);
switch ($number52) {
case 387:
echo "|387, correct|";
break;
}
$number53 = test_input($_POST[""]);
switch ($number53) {
case 53:
echo "|53, correct|";
break;
}
$number54 = test_input($_POST[""]);
switch ($number54) {
case 333:
echo "|333, correct|";
break;
}
$number55 = test_input($_POST[""]);
switch ($number55) {
case 333:
echo "|333, correct</p>|";
break;
}
$number56 = test_input($_POST[""]);
switch ($number56) {
case 333:
echo "|<p>333, correct|";
break;
}
$number57 = test_input($_POST[""]);
switch ($number57) {
case 360:
echo "|360, correct|";
break;
}
$number58 = test_input($_POST[""]);
switch ($number58) {
case 27:
echo "|27, correct|";
break;
}
$number59 = test_input($_POST[""]);
switch ($number59) {
case 333:
echo "|333, correct|";
break;
}
$number60 = test_input($_POST[""]);
switch ($number60) {
case 0:
echo "|0, correct</p>|";
break;
}
}
function test_input($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
?>
我尝试对贷款摊销进行计算,但是遇到两个问题:该页面未显示在浏览器中,而仅显示在代码中,这可能引起什么?是否有代码可以计算所有
$ numbers(减,加,减,乘)?
更详细地讲,我为每个$numbers
分别添加了30 case
个,以便找出是否正确,我想填写所有数字,正确后得到确认。预先感谢。