Re: Another form handling posting question
| From: | Casey | Date: | Thu, 06 Dec 2007 07:40:01 +0000 |
| Subject: | Re: Another form handling posting question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-265494@lists.php.net to get a copy of this message | ||
<?php
echo '<form action="', $_POST['process'] == 'pass' ?
'success' :
'recursive', '.php" method="post">';
?>
>:D
On Dec 5, 2007 11:35 PM, <admin@buskirkgraphics.com> wrote:
> Or try
>
> <?
> echo "<form action=";if(($_POST['process'] == "Pass") ||
> ($_POST['process'] == "")){echo "success.php";}ELSE{echo
> "recursive.php";}echo " METHOD='post'>";
> ?>
>
> There are a 1000 and 1 ways to make the script smaller yet still produce the same effect.
> Remember there is no reason to declare the POST array for matching in this particular setup.
> Some may disagree
>
> Notice I added a error checking if the array is blank.
>
> I am going to stop at this because there are many reasons why the _POST array would or did not
> pass which may not be related to this script directly but cause the issue of less then 100%
> effective.
>
>
>
>
>
>
>
> >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
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
-Casey