I'm using laravel 4. I'm new and I'm trying to make an online test system, I made the view with questions.
我正在使用laravel 4.我是新手,我正在尝试建立一个在线测试系统,我提出了问题。
I have already registered users and administrators. I have authenticated the login. I have authenticated any failure to register a user.
我已经注册了用户和管理员。我已经验证了登录信息。我已经验证了注册用户的任何失败。
I want to know how can I save forms that contain several radio buttons and grade the test automatically.
我想知道如何保存包含多个单选按钮的表单并自动评分测试。
The result can only be viewed by administrators. The result will not be given to the student.
结果只能由管理员查看。结果不会给学生。
Each question has 4 radio buttons. My idea is to assign the true answer "1" and 3 missing responses assign "0" in order to save only the correct answer in the database. but I dont know how to do that.
每个问题都有4个单选按钮。我的想法是分配真正的答案“1”和3个缺失的答案分配“0”,以便只保存数据库中的正确答案。但我不知道该怎么做。
I know I'm asking a lot, but I hope you can tell me how I can do it or put a link where I can base myself to do it. Thanks to all.
我知道我问了很多,但我希望你能告诉我如何做到这一点,或者建立一个我可以自己做的链接。谢谢大家。
1 个解决方案
#1
0
create array key => question values => [answers] in two loops list all the questions with possible answers like
在两个循环中创建数组键=>问题值=> [答案]列出所有可能答案的问题
{{ Form::checkbox('answer_name', 1, false, ["required"]) }}
when user hit the submitt button do the validation stuff, then get only keys form Form where value is true or 1 nvmd. use loop where compare model_answer array with user_answer array and if answer is correct iterate some variable to get result. Remember, position in array counts!
当用户点击提交按钮时,执行验证内容,然后只获取表格中的键,其中值为true或1 nvmd。使用循环比较model_answer数组和user_answer数组,如果答案是正确的,则迭代一些变量以获得结果。记住,数组计数中的位置!
#1
0
create array key => question values => [answers] in two loops list all the questions with possible answers like
在两个循环中创建数组键=>问题值=> [答案]列出所有可能答案的问题
{{ Form::checkbox('answer_name', 1, false, ["required"]) }}
when user hit the submitt button do the validation stuff, then get only keys form Form where value is true or 1 nvmd. use loop where compare model_answer array with user_answer array and if answer is correct iterate some variable to get result. Remember, position in array counts!
当用户点击提交按钮时,执行验证内容,然后只获取表格中的键,其中值为true或1 nvmd。使用循环比较model_answer数组和user_answer数组,如果答案是正确的,则迭代一些变量以获得结果。记住,数组计数中的位置!