Modular Extension - passing data from view to controller via form |
[eluser]ice_prince7[/eluser]
[EDIT - sorry for double posting. it should be here : http://ellislab.com/forums/viewthread/73177/P690/ ] Hi all, sorry to bother you with this might-be-something-obvious problem Im trying out Modular extension by wiredesignz. I got stumble when i want to pass data via form_open. it seems that it doesnt go to my immediate controller, but rather to index.php/product/add_to_cart. This is my hierachy Quote:application/ This is my controller Code: <?php This is my view : Code: <div id="cart"> Any ideas on how do i get the data from view to controllers/product/add_to_cart ? sorry for posting any noob question. thankx
[eluser]Suhas nazir[/eluser]
hey you can use post method to acess data when u use form_open.... like this $this->input->post('variablename');
[eluser]ice_prince7[/eluser]
@SAS : yep, i did it in my controller (modules/product/product): Code: function add_to_cart(){ but the thing is, my form wouldnt redirect me to the add_to_cart method. it simply went on to : index.php/product/add_to_cart instead of to : /modules/product/product/add_to_cart In a normal controller, it should work ok. Due to the fact that im trying out Modular Extension, somehow, it does not redirect properly or something i did prevent it from redirect to the proper method. appreciate your concern, thanks for the reply
[eluser]Suhas nazir[/eluser]
Sry,Sry,I didnt go through the entire code......
[eluser]coolamit[/eluser]
Instead of this Code: <?php echo form_open('product/add_to_cart');?> Code: <?php echo form_open('/modules/product/product/add_to_cart/');?>
[eluser]ice_prince7[/eluser]
yep, i was directed here : http://ci/main.php/modules/product/product/add_to_cart but i didnt get any respond from the controllers 'product' and method 'add_to_cart' that resided in : application/modules/product/controllers/add_to_cart The reason of having modular extension is to have a modular MVC so that it can communicate within the module. Therefore, from my understanding, controllers and views inside the module (say in this case 'product') should be able to communicate to each other, like this : (application/modules/product/views) <-> (application/modules/product/controllers) instead of having to go to the main controllers and views, like this : (application/controllers)<->(application/views) So, by having the form, like this : Code: form_open('product/add_to_cart/) it should go to : application/modules/product/controllers/product/add_to_cart right? hmm, am i getting the concept right? anyway, thank you for the effort @coolamit and @SAS
[eluser]coolamit[/eluser]
Yes it should work like you think, but CI doesn't support modules natively. Which library are you using for this implementation?
[eluser]ice_prince7[/eluser]
im using modular extension ( http://codeigniter.com/wiki/Modular_Extensions_-_HMVC/ ) |
Welcome Guest, Not a member yet? Register Sign In |