![]() |
Posting a form that is included in a page - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Posting a form that is included in a page (/showthread.php?tid=24663) Pages:
1
2
|
Posting a form that is included in a page - El Forum - 11-24-2009 [eluser]JamieBarton[/eluser] Hi again, Also forgot to ask. Say I have a form to create a message, the URL being /messages/new Instead of having two controllers, one to handle including the view, and one to post the actual content, such as /messages/create How would I go about putting it all in one controller? Like if the form is submitted ... Do this, if not, show this etc. I'm probably just being stupid here, as it seems very easy and could do it in Procedural PHP fine. Thanks for your help. Posting a form that is included in a page - El Forum - 11-24-2009 [eluser]Flemming[/eluser] Hi Jamie, the answer is above! But here it is again ... Code: if($this->form_validation->run()) Posting a form that is included in a page - El Forum - 11-24-2009 [eluser]JamieBarton[/eluser] Ah, I thought so! I wasn't sure if the form validation run() meant when the form was submitted. I'm stoopid! Posting a form that is included in a page - El Forum - 12-10-2009 [eluser]dhenoer[/eluser] Comment to post#7 According your codes: Code: function post_to_wall() If you use set_value() function, passing $data into the view('dashboard/wall', $data) will re-populate the form gotten from database again.. So user should miss where my text I've submitted is? :red: Oppsss sorry.. forget my comment.. I think you use initial value that retrieved from database for your form.. Posting a form that is included in a page - El Forum - 05-22-2012 [eluser]InsiteFX[/eluser] You can also create a Forms Library. Code: class Forms { |