Reputation: 718
How to use Routing in CodeIgniter? I've tried but no result. Here's my view:
<a href="/survey/index.php/index/student_surveys/1/" class='btn btn-success'> 1 </a>
<a href='/survey/index.php/index/student_surveys/2/'class='btn btn-success'> 2 </a>
<a href='/survey/index.php/index/student_surveys/3/'class='btn btn-success'> 3 </a>
I tried with this:
$route['survey/index.php/index/student_surveys/1/'] = 'index/student_surveys/1/';
$route['survey/index.php/index/student_surveys/2/'] = 'index/student_surveys/1/';
But when I changed link to test, it doesn't change. It works only with my links not with routing. My controller is:
public function student_surveys() {
$this->form_validation->set_rules('teacher', 'Teacher', 'required');
$this->form_validation->set_rules('subject', 'Subject', 'required|callback_subject');
if ($this->form_validation->run()==FALSE)
{
$this->student_surveys_show();
}
else
{
$this->user_model->add_teacher_subject();
redirect('/index/survey_show/' . $survey_id);
}
}
Upvotes: 0
Views: 147
Reputation: 499
Try this
$route['confirm_registration/(:any)']= "login/confirm_registration/$1";
Upvotes: 3