Two Forms in One Controller?

#1
[eluser]ShoeLace1291[/eluser]
I'm building a members admin page. On the index controller, there's a form that let's you search for members by name. Then on the same controller, database results are queried by the last 5 members to join which creates a form for delete checkboxes. Since there are two forms in the same controller, I've run into a problem with the form_validation->run() function. How do I tell it which form is being executed?

#2
[eluser]mi6crazyheart[/eluser]
I think u'll face problem only when u'll try to do both the things in one function(of controller) else, if u use 2 different controller function for 2 different things(as u've mentioned) then i don't think u'll get any problem...

#3
[eluser]natefons[/eluser]
why not save your self the headache, and do the forms outside the controller?

in the view:
Code:
<form name="formA" method="post" action="/index.php/controller/func1">
blha blah blah
</form>

<form name="formB" method="post" action="/index.php/controller/func2">
blah blah blah
</form>


now in the controller, you would create 2 functions that handles the 2 forms separately.

u can use the $this->input->post to get the post details.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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