Re: Another form handling posting question
| From: | tedd | Date: | Thu, 06 Dec 2007 18:02:09 +0000 |
| Subject: | Re: Another form handling posting question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-265523@lists.php.net to get a copy of this message | ||
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. Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com