Welcome Guest, Not a member yet? Register   Sign In
redirect doesn't work
#11

[eluser]maria clara[/eluser]
[quote author="max123" date="1265978250"]I don't understand about the white space. Also I can't find the extra white space i my code.[/quote]

i have encountered that error before. if im not mistaken i just adjusted the code. but any way, have you tried the code??

can you show me what happen??

EDIT:

have you checked your .htaccess??
#12

[eluser]max123[/eluser]
Yes I tried the code. But still it gives the same error.Can u tell me the location of the white space in my code. I have no idea about the white space

Code:
if($rows>=3)
            {
                redirect('/seeker/my_searches','refresh');
                 echo "[removed]alert('You cannot create more than 3 search agents');[removed]";
            }
#13

[eluser]maria clara[/eluser]
[quote author="max123" date="1265979494"]Yes I tried the code. But still it gives the same error.Can u tell me the location of the white space in my code. I have no idea about the white space

Code:
if($rows>=3)
            {
                redirect('/seeker/my_searches','refresh');
                 echo "[removed]alert('You cannot create more than 3 search agents');[removed]";
            }
[/quote]

have you tried this one?

Code:
if($rows>=3)
            {
                redirect('seeker/my_searches','refresh');
                
            }


Quote:it is something like this:

Code:
<?php

class Sec_users extends Controller {  

    function Sec_users()
    {
        parent::Controller();
        $method = $this->uri->rsegment(2);//uri class segment or retrieve rsegment 2
        $user = $this->session->userdata('user');//fetch 'user' to $user
        if (($method!='login'&&$method!='auth'&&$method!='logout'&&$method!='post')&&!$user) redirect('sec_users/login');    

        $this->load->model('Dataset_db');        
        $this->load->model('Users_db','User');
        #$this->load->model('Main_company_db');
        
            #$lang_select =  $this->input->post('language');
            #$this->lang->load('login', $lang_select);        
        
        $lang_select = $this->session->userdata('lang_select');
        $this->config->set_item('language', $lang_select);    
        
        $this->lang->load('language');//load language file for sec_users e.g sec_user_lang.php
    
        $this->load->helper('url');

        
    }

the codes should be placed in order, like there should be no white space in the header. something like that.

P.S.
I can't explain it directly. having hard time explaining Tongue
#14

[eluser]maria clara[/eluser]
does your
Quote:/seeker/
a folder??

if so, can try fixing the .htaccess with this:

Code:
RewriteRule ^<foldername>/(.*)$ <foldername>/$1 [L]

or try this way:

Code:
if($rows>=3)
            {
                redirect('/seeker/my_searches/','refresh');
                
            }
#15

[eluser]max123[/eluser]
/seeker/ is the controller. I tried all the things you said. But Still it gives the same error. Any ways thanx a lot for your support. Please let me know if u find any solution for this.
#16

[eluser]max123[/eluser]
Hi maria,
I found the reason. There are 2 echo statements inside a function above to the function that has redirect. I removed those echo statements. Now redirect works finely. Now the problem is how can I use those echo statements in the upper function. Do u have any idea?
#17

[eluser]maria clara[/eluser]
[quote author="max123" date="1265985096"]Hi maria,
I found the reason. There are 2 echo statements inside a function above to the function that has redirect. I removed those echo statements. Now redirect works finely. Now the problem is how can I use those echo statements in the upper function. Do u have any idea?[/quote]

can you post the code that refers to it?? or errors if you have
#18

[eluser]coolgeek[/eluser]
[quote author="max123" date="1265985096"]Hi maria,
I found the reason. There are 2 echo statements inside a function above to the function that has redirect. I removed those echo statements. Now redirect works finely. Now the problem is how can I use those echo statements in the upper function. Do u have any idea?[/quote]

You can't redirect after you've already echoed something. HTTP headers were already sent in order to execute the echo statements. The redirect() function sends a redirect header.

You will need to store the statements in a session variable and present them from within the page you redirect to.




Theme © iAndrew 2016 - Forum software by © MyBB