PHP POST表单失败,目标页无法接收,怎么办?-问答-阿里云开发者社区-阿里云

开发者社区> 问答> 正文

PHP POST表单失败,目标页无法接收,怎么办?

小旋风柴进 2016-03-06 15:14:12 1297

我想通过这个代码实现试卷试题的生成,通过循环生成了单选题目,并想通过数组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);
?>
SQL 前端开发 PHP
分享到
取消 提交回答
全部回答(1)
  • 小旋风柴进
    2019-07-17 18:54:41

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

    0 0

集结各类场景实战经验,助你开发运维畅行无忧

推荐文章
相似问题
推荐课程