Welcome Guest, Not a member yet? Register   Sign In
insert/edit many to one records
#1

[eluser]jared4444[/eluser]
Hi,
I am very new to CI, and MVC (only 2 days). I am really struggling with how to even get started on this issue.

Here is what I am doing:

I have two tables (simplified)

Item
ID, itemName (nothing else important here)

Size
ID, name, itemID, price

ex.
Item = 1, pizza
size = 1, small, 1, 2.00
size = 2, medium, 1, 3.00
size = 3, large, 1, 4.00

So I am building a db with pizza sizes small, medium, and large with associated prices.


I know how to make one form and save/edit items, I can also do the same for sizes.

I would like to have one form where I can enter an item, then below do the sizes, and have this page reload and be able to validate, but all the examples I see have to do with editing one record at a time.

Item Name = _____________
[add size]

click add size would bring up

Item Name = _____________
Size Name=____________ Size Price=____________ [delete size]
[add size]

click add size would bring up

Item Name = _____________
Size Name=____________ Size Price=____________ [delete size]
Size Name=____________ Size Price=____________ [delete size]

How would I ever get this started? I don't know how to edit multiple records on the same form, especially when they come from different tables (item, size). Also, if someone were to remove the item name and I had to validate it, what happens to the sizes since they would not be processed by the db? Would I have to save all form variables, and be able to repopulate the form again?

As you can see I am pretty clueless with this. Any help would be great!


Messages In This Thread
insert/edit many to one records - by El Forum - 06-15-2009, 07:47 AM
insert/edit many to one records - by El Forum - 06-15-2009, 08:29 AM
insert/edit many to one records - by El Forum - 06-15-2009, 08:42 AM



Theme © iAndrew 2016 - Forum software by © MyBB