• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Return manipulated form data from model to controller.

Hey Everybody,
I'm using the excellent form generation library and have forms submit to a function in MY_Model that takes the data and table name and runs a bunch of tests and array manipulation. One of which determines whether it's an update or insert statement and saves the $data['ID'] or $this->db->insert_id() and returns the entire array. The end goal is to have a validated form in the controller redirect the url to /path/to/ID/# and always be right, regardless of it being a new insert or an update function. I also have a problem when a secondary insert happens after the initial query, in which case $this->db->insert_id() returns the wrong ID in the controller.

Any ideas? I'm trying to avoid running test to see if $this->db->insert_id() is set on each and every form, probably 3-400 in total. Thanks for your help and a wonderful product!

[eluser]TWP Marketing[/eluser]
We're going to need to see some of your code and any errors you are getting (browser, apache, php etc.)

I'm not sure exactly which path you are using in your form in the action parameter. Normally this will point at a Controller method and not a model function, which is how I could interpret your post. Could you give us an example please?

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

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