PHP POST表单失败,目标页无法接收

我想通过这个代码实现试卷试题的生成,通过循环生成了单选题目,并想通过数组POST给验证页面进行评分,但是我发现无法获取check[]数组,也无法POST到目标页面。
作为新手,目的是想实现功能,因此代码很冗杂- -
quesid[$i]数组可以正常传递给目标页面。
真心求教。
代码如下:



试卷
<? require ("../css/css.php");?>

session_start(); if(isset($_SESSION['id'])){ $admin = $_SESSION['id']; $query = "select * from admin_info where admin_id = '$admin'"; //select admin information $result = mysqli_query($dbc,$query); $rows = mysqli_fetch_array($result); $admin_name = $rows['admin_name']; $admin_id = $rows['admin_id']; echo "

"; echo ''.$admin_name.'('.$admin_id.')您好!
'; } ?> //get sql test information $query = "select * from test_info where test_number = '000'"; $result = mysqli_query($dbc,$query); $rows = mysqli_fetch_array($result); $update_name = $rows['update_name']; $test_number = $rows['test_number']; $test_name = $rows['test_name']; $class_one = $rows['class_one']/100; $class_two = $rows['class_two']/100; $class_three = $rows['class_three']/100; $danx_quantity = $rows['danx_quantity']; $duox_quantity = $rows['duox_quantity']; $pand_quantity = $rows['pand_quantity']; $test_uptime = $rows['test_uptime']; $test_start = $rows['test_start']; $test_end = $rows['test_end']; $test_duration = $rows['test_duration']; $test_status = $rows['test_status']; ?>

echo '

'.$test_name.'

'; echo '注意:
&nbsp &nbsp &nbsp 1.你有'.$test_duration.'的时间答题,请把握好时间;
&nbsp &nbsp &nbsp 2.理论考试包含有单选题:'.$danx_quantity.'题、多选题:'.$duox_quantity.'题、判断题:'.$pand_quantity.'题;
&nbsp &nbsp &nbsp 3.各部分内容所占比例为,政治理论基础:'.($class_one*100).'%、 条令条例:'.($class_two*100).'%、军兵种常识与军事高技术:'.($class_three*100).'%。
'; ?>

一、单项选择题

$danx_quantity; $class_one_num = round(($danx_quantity*$class_one),0); $class_two_num = round(($danx_quantity*$class_two),0); $class_three_num = ($danx_quantity - $class_one_num - $class_two_num); //科目一 for($id = 1,$sub_id = 1,$c1_id = 1;$sub_id &nbsp'.$question_cont.'

'; echo ''; echo '&nbsp &nbsp A.'.$danx_choiceA.'
'; echo '&nbsp &nbsp B.'.$danx_choiceB.'
'; echo '&nbsp &nbsp C.'.$danx_choiceC.'
'; if($danx_choiceD != NULL){ echo '&nbsp &nbsp D.'.$danx_choiceD.'
'; } else { echo '
'; } echo ''; echo '
'; echo "----------------------
"; } //科目二 for($sub_id,$id,$c2_id = 1;$sub_id "$question_id"); $ques_id[$id] = $question_id; echo '['.$ques_id[$id].']'; echo '&nbsp'.$question_cont.'

'; echo ''; echo '&nbsp &nbsp A.'.$danx_choiceA.'
'; echo '&nbsp &nbsp B.'.$danx_choiceB.'
'; echo '&nbsp &nbsp C.'.$danx_choiceC.'
'; if($danx_choiceD != NULL){ echo '&nbsp &nbsp D.'.$danx_choiceD.'
'; } else { echo '
'; } echo ''; echo '
'; echo "----------------------
"; } //科目三 for($sub_id,$id,$c3_id = 1;$sub_id &nbsp'.$question_cont.'

'; echo ''; echo '&nbsp &nbsp A.'.$danx_choiceA.'
'; echo '&nbsp &nbsp B.'.$danx_choiceB.'
'; echo '&nbsp &nbsp C.'.$danx_choiceC.'
'; if($danx_choiceD != NULL){ echo '&nbsp &nbsp D.'.$danx_choiceD.'
'; } else { echo '
'; } echo ''; echo '
'; echo "----------------------
"; } ?>

for($i = 1;$i "; } ?>



返回上级| 退出登录


POST目标页面:test_check.php
<?

for($i=1;$i <=100;$i++)
{
$check[$i] = $_POST['check'][$i];
$ques[$i] = $_POST['quesid'][$i];
}
print_r($check);
echo "
";
print_r($ques);
?>

5个回答

直接上代码呀,不然怎么帮你分析呢

你的html中没有check。

$check[$i] = $_POST['check'][$i];

起码要有一个的控件吧。

生成的数组使用json_encode()函数转化为字符串传递给验证页面,验证页面使用json_decode()方法再转化为数组,再在验证页面中执行验证操作。

还是把这块的代码贴出来吧,让大家帮你看看!!!

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐