【发布时间】:2015-11-03 09:45:53
【问题描述】:
我正在开发一个简单的测验网络应用程序,我想验证提交按钮上的每一个问题,显示正确并为正确的问题添加标记。
我已经创建了这样的第一个问题页面
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Cric Quiz </title>
<link href="<?php echo base_url(); ?>assets/style.CSS" rel="stylesheet" type="text/css"/>
</head>
<body>
<div>
<h1>Cric Quiz</h1>
</div>
<div id='quesNo'>
<center>Question 01</center>
</div>
<div id='questions'>
<center>When did Australia win their first ever world cup?</center>
</div>
<div id='answers'>
<input type="radio" name="year" value="1992">1992<br>
<input type="radio" name="year" value="1996">1996<br>
<input type="radio" name="year" value="2000">2000<br>
<input type="radio" name="year" value="2012">2012
</div>
<center><a href="<?=base_url().'index.php/Questions/question_2';?>" class="button1">Next</a></center>
</body>
</html>
我的控制器
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Questions extends CI_Controller {
public function question_1()
{
$this->load->view('quiz_one');
}
public function question_2()
{
$this->load->view('quiz_two');
}
}
如何在我的控制器中验证我的答案
PS:我正在使用 codeigniter
【问题讨论】:
标签: php html codeigniter validation