Re: Re: form submission logic
| From: | Torsten Roehr | Date: | Mon, 10 May 2004 13:02:33 +0000 |
| Subject: | Re: Re: form submission logic | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-185793@lists.php.net to get a copy of this message | ||
>"Jay Blanchard" <jay.blanchard@niicommunications.com> wrote in message
news:C8F323573C030A448F3E5A2B6FE2070B0352250A@nemesis...
>[snip]
>This is more of a HTML than a PHP question, but anyway:
>It doesn't matter where you put the buttons as long as they are INSIDE
>the
>form-tag and have different names.
>[/snip]
>
>Actually you can name them all the same thing and then have PHP process
>the form via a switch/case statment.
>
><input type="submit" name="action" value"Publish">
><input type="submit" name="action" value"Un-Publish">
>
><?php
>
>switch($_POST['action']){
> case "Publish":
> ... do stuff ...
> break;
>
> case "Un-Publish":
> ... do stuff ...
> break;
>
>}
Correct, but it might quickly break your code if you decide to give the
button a different label (value attribute). This could be solved, though, by
working with constants that are defined in a seperate language resource
file.
Regards, Torsten