CodeIgniter Forums
How to redirect to another view from a view - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: How to redirect to another view from a view (/showthread.php?tid=33569)



How to redirect to another view from a view - El Forum - 08-31-2010

[eluser]Unknown[/eluser]
Hey folks,

new to CI, just need some insight. I have a view with a form using the form helper, now what do I set the target to to redirect it to another view? would I need to redirect back to the controller?

Code:
<?php echo form_open('CodeIgniter_1.7.2/country_search/country_list'); ?>

Thanks


How to redirect to another view from a view - El Forum - 08-31-2010

[eluser]leonardteo[/eluser]
Yeah you always call a controller, which then calls the views you want.

Take a look at this page on using the form_validation class:
http://ellislab.com/codeigniter/user-guide/libraries/form_validation.html

That should shed some insight on using a single controller function to control which views are shown based on whether the user has posted valid content in the form.

Good luck,

L.


How to redirect to another view from a view - El Forum - 08-31-2010

[eluser]pickupman[/eluser]
Don't think of views as part of the url. You can have as many views you want for a url. CI just loads each one you call. Form urls should go to your controller/method.