Click here to Skip to main content
15,884,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My code :

PHP
if($mail->Send()) 
				  
				  {
					 $this->session->set_flashdata('Smessage','<span class="label label-info">Your request has been sent!</span>');
					 header("location:$baseurl/index.php");
					 
				  } 
				  else 
				  {
					echo "Mailer Error: " . $mail->ErrorInfo;
					$this->session->set_flashdata('Fmessage','<span class="label label-info">Message could not sent.Please contact Administrator.!</span>');
					header("location:$baseurl/index.php");
				  }



After sending mail from controller, if mail sent successfully i need to redirect user to home page

but the problem i'm facing is i got redirected to view(home) but the url is not changing it remains unchanged.. i want both redirection and url change...
Posted
Updated 24-Oct-13 3:43am
v7
Comments
Timberbird 24-Oct-13 10:27am    
Unchanged URL is usually a result of server redirects, but since it's unclear... Have you checked server response and next browser request - for example, with Fiddler2 tool? What does it show? Does this issue exist in all browsers? The problem can be reproduced locally on the server itself?
Ramkumar K 25-Oct-13 2:59am    
Yes,The problem exists on all browsers..actually i'm trying to redirect to a page(application/views/home.php) from the controller under the method "register". After redirecting the url is looks like "http://192.168.1.62/mobile/index.php/home/mail". preferred url is "http://192.168.1.62/mobile/index.php/home". how to remove the method name 'mail' from the url ?
Timberbird 25-Oct-13 4:13am    
Actually I'm not familiar with PHP and MVC pattern implementation there. I would suggest looking here - it proposes to include JavaScript (which will work in all cases) and also mentions something about controllers and output
Ramkumar K 25-Oct-13 6:32am    
Thanks Timberbird . It is not working..Your Intent to help was great.. thanks again :)

1 solution

In codeigniter use redirect instead of header.

PHP
redirect('controller_name');


For example in your case :

PHP
redirect('home');



Regards,
Zeeshan.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900