On Thu, 2007-12-06 at 13:02 -0500, tedd wrote: > At 10:36 PM -0700 12/5/07, Mike Smith wrote: > >I am trying to recursively send data to the same form. > > > >-snip- > > > >What is the best practice for doing this? > > > > I don't know what the "best" practice is, but this is the way I do it. > > In the form I have a hidden field called step that controls flow via POST.. > > Based upon that value, I use a switch to direct the flow to different > forms -- all the forms have the same submit button. > > So, it looks like this (pseudo-code): > > $step = isset($_POST['step']) ? $_POST['step'] : 1; > > <form action=self method=post> > > switch $step > { > case 1: > // present the form for step 1 > <input hidden step=2> > > case 2: > // present the form for step 2 > <input hidden step=3> > > case 3: > // present the form for step 3 > } > > <input type=submit name=submit type=submit> > > That way, it's simple to recursively change a form to gather information. > > If you want to keep/store data in each gather, then either save it to > a dB or do sessions. > > It works for me. Not to critique your form logic itself, but IMHE it is much better to name the submit button "continue" and not "submit". Some browsers, maybe all (I can't remember), screw things up when you try to do form.submit() in JavaScript if there is a field called submit. Cheers, Rob. -- ........................................................... SwarmBuy.com - http://www.swarmbuy.com Leveraging the buying power of the masses! ........................................................... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php