Re: Many forms in one php file

From: Date: Tue, 15 Feb 2005 18:51:07 +0000
Subject: Re: Many forms in one php file
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-208755@lists.php.net to get a copy of this message
Hello NSK, Tuesday, February 15, 2005, 8:21:43 AM, you wrote: N> After the user completes and submits Form1, the script will process N> it and display a different form. etc... There's a boatload of ways to do this, but here's a real simple one to get you rolling. I'll leave it up to you to make it better. <?php if ($_POST['form3Complete'] == 1) { echo "You're done! Thanks."; exit; } if ($_POST['form2Complete'] == 1) { ?> <form name="form3" method="post" action="<? echo $_SERVER['PHP_SELF']";?>> //Your form stuff <input type="hidden" name="form3Complete" value="1"> </form> <?php } elseif ($_POST['form1Complete'] == 1) { ?> <form name="form2" method="post" action="<? echo $_SERVER['PHP_SELF']";?>> //Your form stuff <input type="hidden" name="form2Complete" value="1"> </form> <?php } else { ?> <form name="form1" method="post" action="<? echo $_SERVER['PHP_SELF']";?>> //Your form stuff <input type="hidden" name="form1Complete" value="1"> </form> <?php } ?> -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.2.3 Rush under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB

« previous php.general (#208755) next »