How to do "Add More"/expanding forms?

From: Date: Thu, 30 Aug 2001 17:20:37 +0000
Subject: How to do "Add More"/expanding forms?
Groups: php.general 
Request: Send a blank email to php-general+get-65337@lists.php.net to get a copy of this message
I have a page that is for a little recipe database app. On the page where you enter your recipe, there is a set of form fields for ingredients - one line per ingredient, and a couple of fields per (e.g. amount, measurement, ingredient). I'd like to have say 5-10 ingredient lines in the form by default, but put an "Add More" button next to the last one that will let the user say add 5 more ingredient lines to the form. How can I do this? The problem for me is that I figure I'd want the Add More button to either do a POST to the same page (and add a parameter indicating the number of ingredient lines to use or something like that), but that the standard form Submit/Add Recipe button would go to a different PHP page that actually inserted the recipe into the database. But, this requires two forms and thus I'd lose the recipe's form variables when hitting one or the other of the buttons. I've looked around online for solutions to this, but haven't found any. Can someone point me in the right direction? ____ Chris Bailey mailto:chris@codeintensity.com Code Intensity http://www.codeintensity.com

« previous php.general (#65337) next »