这是我的表格网址:
http://localhost/MCQQuizWebApp/index.php
这是表格:
<?php echo form_open('front_controller/show_result'); ?>
<?php
$ques_no = 1;
foreach($questions as $question)
{
echo '<div class="section">';
echo '<div class="question">';
echo 'Q' . $ques_no . '. ' .$question->ques_desc;
echo '</div>';
foreach($choices[$question->ques_id] as $choice)
{
echo '<div class="choice">';
echo $choice;
echo '</div>';
}
$ques_no++;
echo '</div><br>';
}
?>
<input type="submit" value="Submit"/>
<?php echo form_close();?>
这是我的控制者:
class Front_controller extends CI_Controller{
public function __construct()
{
parent::__construct();
$this->load->helper('form');
}
public function index()
{
}
public function show_result(){
}
form_open(&#39; front_controller / show_result&#39);不会重定向到网址http://localhost/MCQQuizWebApp/index.php/front_controller/show_result
从
生成代码form_open('front_controller/show_result');
是
<form action="http://::1/MCQQuizWebApp/index.php/front_controller" method="post" accept-charset="utf-8">
答案 0 :(得分:1)
你可以尝试这个,只需在你的前面<form role="form" method="post" action="<?php echo site_url('front_controller/show_result');?>">