Re: Many forms in one php file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux