我有这两个文件。
一个.php
<?
echo "
<form action = 'B.php' method = 'post'>
5+5 = ?
Write answer: <input type = 'text' name = 'op1'>
10+10 = ?
Write answer: <input type = 'text' name = 'op2'>
</form>
";
?>
B.php
<?
$op1 = $_REQUEST ['op1'];
$op2 = $_REQUEST ['op2'];
if ($op1 == '10'){
echo "Right answer. 2p.";
$mark = '2';
}else{
echo "Wrong answer. 0p.";
$mark2 = '0';
}
if ($op2 == '20'){
echo "Right answer. 2p.";
$mark3 = '2';
}else{
echo "Wrong answer. 0p.";
$mark4 = '0';
}
?>
如何进行表达式以进行总加?我写了一个简单的例子,我的有 20 个操作,我该怎么做取决于答案加 2 点或 1 点或 0 并最终写出结果?(就像从0到10的考试)
谢谢。