RE: Another form handling posting question

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

 






hi,mike i suggest that you use Javascript to done this work. like this: <form onsubmit="submitprocess();" method="post" id="form1">...<input type="text" id="process" value="pass"></form> <script>function submitprocess(){var pobj=document.getElementById("process");var fobj=document.getElementById("form1");if (pobj.value=="pass"){ fobj.action="sucess.php";//change form1's action value return true;//submit the form1}else{ fobj.action="recursive.php"; return true;} }</script>

> To: php-general@xxxxxxxxxxxxx> From: mike.l.smith@xxxxxxxxxxx> Date: Wed, 5 Dec 2007 22:36:57 -0700> Subject:  Another form handling posting question> > I am trying to recursively send data to the same form. Based on the data, I > want to determine which "action" is to be processed. It appears that the > $_POST is not being cleared out or cached once it is sent to the server. > Here is my code that I'm trying to test with. It doesn't seem to > consistently send me to the correct page each time.> > <?php> > $process = $_POST['process'];> > if ($process == "Pass")> {> echo "<form method='POST' action=success.php>";> }> else> {> echo "<form method='POST' action=recursive.php>";> }> ?>> > <table border="0" id="table1" width="58">> <tr>> <td align="center">> <input type="radio" checked name="process" value="Pass" > tabindex="1"></td>> <td align="left">Pass</td>> </tr>> <tr>> <td align="center" width="20">> <input type="radio" name="process" value="Fail" tabindex="2"></td>> <td align="left" width="28">> Fail</td>> </tr>> </table>> <input type="submit" value="Submit" name="B1"> <input type="reset" > value="Reset" name="B2">> </form>> > I want to use a single submit button that will send the "action" to the > right page.> > What is the best practice for doing this? > > -- > PHP General Mailing List (http://www.php.net/)> To unsubscribe, visit: http://www.php.net/unsub.php> 

Your smile counts. The more smiles you share, the more we donate. Join in! 
_________________________________________________________________
Your smile counts. The more smiles you share, the more we donate.  Join in.
www.windowslive.com/smile?ocid=TXT_TAGLM_Wave2_oprsmilewlhmtagline

[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