To connect to a database with controller |
[eluser]grejsimojs[/eluser]
Hello everyone. I've got a form and the "action" of it should be pointed to a controller, if I've understood it correctly. What am I supposed to type into that controller? I'm extremely confused. I've read the guide but I'm still stuck.
[eluser]boltsabre[/eluser]
Quote:To connect to a database with controllerAll your DB stuff should be done in a model, not your controller. If it's all a bit confusing for you, I'd highly recommend going through some of the video tutorials and code along with them, I think it's the best way to understand (and learn how to use) a MVC environment if it's new to you. http://codeigniter.com/tutorials/
[eluser]LuckyFella73[/eluser]
In the controller your form points to, you write code that processes the data send by the form and display feedback to the user about that process. In the user guide you find a complete example how you can do that: http://ellislab.com/codeigniter/user-gui...ation.html
[eluser]grejsimojs[/eluser]
Thanks for the replies guys. I know how to create a form as I already have one. The only thing I'm not quite getting the hang of is how to connect that form to the database so that when the form is filled in, the information will be sent to the database. That's my issue. Sorry if I wasn't clear.
[eluser]LuckyFella73[/eluser]
Here is (very basic) how you can insert form data into a database: Code: <?php Adjust $db_data coresponding to your table columns and input fields (name attr). |
Welcome Guest, Not a member yet? Register Sign In |