php - Pass query string to same method in controller in codeigniter
I am Trying To Reload Contents Of Page. Through link button Filter In PHP By Passing Some Value Through Query String To Controller Method. The Controller Method Loads The Same Page From Where I am Passing Query String. But The View Is Not Reloading. But If I Call The Controller Method Some Other View It Works Fine. here is my code
mainview.php
<a href="<?=base_url()?>maincontroller?language=English">English</a>
maincontroller.php
Here Is The Index Method Of Controller.
$movielanguage=$this->input->get('language');
if(!empty($movielanguage))
{
$moviedata['popularmovies']=$this->main_model-
>getmoviebylanguage($movielanguage);
}
$moviedata['allmovies']=$this->main_model->getAllMovies();
$this->load->view('home/mainview.php',$moviedata);
}
Here View Does Not Refresh Its Contents How Can I Solve This
Answer
Solution:
Hope this will help you :
First if you want a single view ,should put you code it in
if else
condition and second assign your data in same variableYour code should be like this :
Second : and if you want to add different view for different category of movies
You can do like this :