欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

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

程序员文章站 2022-06-06 23:43:27
...
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 {
$check[$i] = $_POST['check'][$i];
$ques[$i] = $_POST['quesid'][$i];
}
print_r($check);
echo "
";
print_r($ques);
?>