Thomas: I think 2 responses ago Cricket gave the best answer so far. Check out this page on the CakePHP docs that shows how to create an input with the "[]" modifier to the form name:
http://book.cakephp.org/view/1395/options-multiple I know it can be frustrating inheriting a project and we have all been there at one point or another. I can imaging it's even more frustrating when it's a framework you don't haven't been accustom to using. If you are going to spend more than 2-3 hours on this project (and it sounds like you are) then here is how you can instantly make yourself much more productive, and less frustrated: 1. Read the entire CakePHP Cook Book for your CakePHP version (1.1, 1.2, or 1.3) located at book.cakephp.org. It's a simple and easy read, you'll breeze right through it. 2. Keep in mind there may be an improved method for trying to accomplish something you used to have to do by hand in PHP. The built- in form libraries really speed up development, however, it could be very frustrating if you haven't been introduced to them before. Use the book and API as a guide. 3. If you are stuck, email this list or go on IRC and we'll do our best to help you out! You can always post large code snippets to bin.cakephp.org (username is your IRC name, or whatever name you feel like making up on the spot.) 4. If you are in NYC, join my CakePHP meetup group on Meetup.com =) Regards, David On Feb 20, 12:10 am, cricket <zijn.digi...@gmail.com> wrote: > On Sat, Feb 19, 2011 at 11:33 PM, Thomas <treedi...@gmail.com> wrote: > > Wow, not really sure what to say. The example you provided is pretty > > much what I have now. I still have not gotten an answer. Can cake > > dynamically create the post array key, again referencing this > > example:? > > <input type="text" name="name[]"> > > Maybe none of you have seen this because it is not possible in cake. > > Maybe we're all idiots. > > The empty square brackets thing in form names is very well understood. > The thing is, Cake doesn't use them. > > > But I would like a definitive answer from somebody. > > No kidding? And I thought people used this list to trade gossip. > > > Let me explain what my form is doing. I assume that the dilemma is not > > understood. Basically there is a variable number of classes. The user > > opts to register for the class using a checkbox and then indicates the > > number of seats they wish to purchase. Now what I would love to know > > is how in cake land the association between selected classes and > > number of seats is made for the purpose of forming a query. > > > Remember the array will have 20 key/values if there are 20 classes > > even if only 3 are selected. Then for the three how do you know the > > proper key/value in the text (no seats) array? > > So you need to match up the class checkboxes with the no. of seats > inputs. I'm still not seeing why you're so confused about the use of > $i in a loop. > > BTW, have you tried looking at the submitted data? Set debug to 2 in > core.php and: > > if (!empty($this-data)) > { > die(debug($this->data)); > > You haven't, in fact, stated that there's an actual problem, aside > from that the code isn't written the way you're used to. > > > I think in cake that is called a controller. > > A controller is a class. It's what handles a typical request. Perhaps > you meant that the key/values are handed to the controller? That is > correct. > > > I would like someone to > > write a routine to accomplish this without reqiring a bunch of string > > manipulation. > > http://www.catb.org/~esr/faqs/smart-questions.html > > > Has anyone here developed anything not using cake? > > I won't be offended by that because 1) I realise that nobody had > clairified why the name[] notation isn't used in Cake; and, 2) with > some of the *other* questions that have been posted here lately, it's > looking like an awful lot of people *do* jump into Cake without any > programming experience at all. ;-) > > You still haven't posted: > a) the loop code > b) a description of the models involved and their associations > > Perhaps we can get this straightened out for you. Meanwhile, try not > to be so hostile. At least until you've been around for awhile. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php