![]() |
redirect doesn't work - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: redirect doesn't work (/showthread.php?tid=27476) Pages:
1
2
|
redirect doesn't work - El Forum - 02-11-2010 [eluser]max123[/eluser] redirect doesn't work. Can anybody tell me the reason. This is my function function create_search_agent() //create a new search agent { $this->load->model('vacancy_model'); $this->load->model('profile_model'); $this->load->model('search_agent_model'); $this->load->helper('url'); $data=array(); if (($this->session->userdata('email'))== NULL) { $this->session->set_flashdata('message', 'Please login to view this page.'); redirect('home/index/-'.$var); } $email=$this->session->userdata('email'); $user_id= $this->profile_model->get_id_by_email($email); $search_agents = $this->search_agent_model->get_search_agents($user_id); $rows = $search_agents->num_rows(); if($rows>=3) { redirect('/seeker/my_searches', 'refresh'); echo "[removed]alert('You cannot create more than 3 search agents');[removed]"; } // -------some more codes This is the error t got A PHP Error was encountered Severity: Warning Message: Cannot modify header information - headers already sent by (output started at D:\xampp\htdocs\Mycareergate3\system\application\controllers\seeker.php:13) Filename: helpers/url_helper.php Line Number: 528 redirect doesn't work - El Forum - 02-12-2010 [eluser]maria clara[/eluser] try it like this way Code: redirect('/seeker/my_searches','refresh'); or this Code: redirect('my_searches','refresh'); edit: try it without refresh ![]() redirect doesn't work - El Forum - 02-12-2010 [eluser]max123[/eluser] Both are not working. Also there are no 'echo' statements above the redirect function. I'm struggling for hours to solve this. Please help if u have time Thanx redirect doesn't work - El Forum - 02-12-2010 [eluser]maria clara[/eluser] [quote author="max123" date="1265976849"]Both are not working. Also there are no 'echo' statements above the redirect function. I'm struggling for hours to solve this. Please help if u have time Thanx[/quote] have you loaded a url helper?? if not load it Code: $this->load->helper('url'); can you show me the full part of this code?? Code: if($rows>=3) EDIT: i saw your helper. Sorry for not reading ![]() redirect doesn't work - El Forum - 02-12-2010 [eluser]max123[/eluser] how can I paste the code with colors for keywords like u did redirect doesn't work - El Forum - 02-12-2010 [eluser]maria clara[/eluser] [quote author="max123" date="1265977238"]how can I paste the code with colors for keywords like u did[/quote] put "code" in a bracket and ends it with a "/" like in html tags for the coding like mine. or you can click the "code" button above in the FORMATTING redirect doesn't work - El Forum - 02-12-2010 [eluser]max123[/eluser] function create_search_agent() //create a new search agent { $this->load->model('vacancy_model'); $this->load->model('profile_model'); $this->load->model('search_agent_model'); $this->load->helper('url'); $data=array(); if (($this->session->userdata('email'))== NULL) { $this->session->set_flashdata('message', 'Please login to view this page.'); redirect('home/index/-'.$var); } $email=$this->session->userdata('email'); $user_id= $this->profile_model->get_id_by_email($email); $id=$user_id; $search_agents = $this->search_agent_model->get_search_agents($user_id); $rows = $search_agents->num_rows(); if($rows>=3) { redirect('/seeker/my_searches','refresh'); echo "[removed]alert('You cannot create more than 3 search agents');[removed]"; } $data['controller'] ="set_search_agent/$id"; $data['keyword'] = ''; $data['category_id'] = ''; $data['country_id'] = ''; $data['city_id'] = ''; $data['date_posted_id'] = ''; $data['heading'] ="Create a search agent"; $data['job_categories2'] = $this->vacancy_model->get_job_categories(); //get job categories $data['countries'] =$this->vacancy_model->get_countries(); // get countries $data['city_states'] =$this->vacancy_model->get_city_states(); // get cities and states $data['date_posted'] =$this->vacancy_model->job_posted_dates(); // get cities and states $data['user_id'] = $this->profile_model->get_id_by_email($this->session->userdata('email')); //gives an error when remove this redundent line $data['header'] = $this->top_job->get_header($this->redux_auth_model->getUserGroupByUserId($email)); //get header $data['display_name'] = $this->profile_model->set_get_display_name($this->session->userdata('email')); $data['loginPage'] = $this->load->view('login',$data, TRUE); $data['banner'] = $this->load->view('banner',$data,TRUE); $data['footer'] = $this->load->view('footer','',TRUE); $this->load->view('seeker/search_agent_create',$data); } redirect doesn't work - El Forum - 02-12-2010 [eluser]max123[/eluser] Code: function create_search_agent() //create a new search agent redirect doesn't work - El Forum - 02-12-2010 [eluser]maria clara[/eluser] Quote:A PHP Error was encountered there should be no white spaces. instead of Code: if($rows>=3) try Code: if($rows>=3) redirect doesn't work - El Forum - 02-12-2010 [eluser]max123[/eluser] I don't understand about the white space. Also I can't find the extra white space i my code. |