• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
form redirection

#1
hi guys,

Hope you are all fine.
starting with CI, i have a quick question.
in my controllers, i have contact.php with this code:

PHP Code:
$this->email->from($sender_name,$from);
        
        
$this->email->to('test@test.com');
         
        
$this->email->subject('Contact Us');
        
        
$this->email->message($template);
        
        
$this->email->send();
        
        
redirect('home'); 

my problem is the last line. i have a site in spanigh and english, how can i make rediction to spanish after submit ?
when we are in spanish and vice-versa?

thanks for your help
Reply

#2
Well how does your user switch languages normally? If it's just by visiting some endpoint, redirect him to that endpoint (e.g. redirect('home/spanish')Wink.
Reply

#3
(04-18-2015, 09:08 AM)gadelat Wrote: Well how does your user switch languages normally? If it's just by visiting some endpoint, redirect him to that endpoint (e.g. redirect('home/spanish')Wink.

The thing is if i do i like this, now the problem come from the other side
if you are in englih part of site and fill form you will be redirect to spanish ...
and yes my users switch languages normally
thanks
Reply

#4
The thing is if i do i like this, now the problem come from the other side
if you are in englih part of site and fill form you will be redirect to spanish ...
and yes my users switch languages normally
thanks
Reply

#5
You need to determine what language the user is currently using. This is determined by whatever method you used to set the language in the first place. If it's just set by a route in your application, you need to check the relevant portion of the URI. If it's set in the config or the session, you need to retrieve it from there.

Once you know which language the user is currently using, you just send them to the appropriate page.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.