I haven't had any experience with switch at all, but I do have forms
with multiple submit buttons.
I've been running things slightly differently:
<FORM action="rap.php" method="post">
...
<input type="submit" name="submit" value="Add Names">
<input type="submit" name="submit" value="Submit">
</FORM>
Then rap.php has a basic if statement:
<?
if($submit == "Add names")
{
... do this ...
}
elseif($submit == "Submit")
{
... do this ...
}
else
{
... they didn't click a button, maybe pressed enter, so there's no
submit value ...
}
?>
Otherwise, the code you have below seems to be missing some <? ?>'s
around the PHP, but it might be "psuedo code".
Good luck,
Justin French
Andre Dubuc wrote:
>
> I'd like to control which php file is called when clicking two buttons on the
> bottom of a form; one called "Add Names", the other "Submit"
>
> I've tried the following with no success:
>
> *******************************************
> <form action=
> switch ($name) {
> case add:
> "rap.php" method "get">;
> break;
> case submit:
> "rap2.php" method "get">;
> break;
> }
>
> . . .
>
> <input type="submit" name="add" value="Add Names">
> <input type="submit" name="submit" value="Submit">
> </form>
>
> **************
>
> I'm still a newbie, and this is the first time I've tried to use a switch
> statement. I've probably performed an illegal operation by splitting the
> <form action . .> statement. Is there any other way of accomplishing a change
> of action? This seems so clumsy -- and also, since the clicking occurs only
> after all info is entered, does the info actually get stored anywhere prior
> to clicking or pressing Enter?
>
> Btw, I've also tried putting this switch statement after the <input ...>
> code, and also tried "if" statements. It usually defaults to whatever is
> loaded, and doesn't respond to the "if" or "switch" statements.
>
> I'd appreciate any help on this -- or pointers where to look.
>
> Tia,
> Andre
>
> --
> Please pray the Holy Rosary to end the holocaust of abortion.
> Remember in your prayers the suffering souls in Purgatory.
>
> May God bless you abundantly in His love!
>
> For a free Cenacle Scriptural Rosary Booklet -- http://www.webhart.net/csrb/
>
> --
> 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