Re: $_POST['xxx'] = "blabla" ?
| From: | Robin Vickery | Date: | Mon, 22 Nov 2004 21:20:26 +0000 |
| Subject: | Re: $_POST['xxx'] = "blabla" ? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-202701@lists.php.net to get a copy of this message | ||
On Mon, 22 Nov 2004 21:57:23 +0100, Perry Jönsson <public@combinative.se> wrote:
>
> Maybe a daft question but why would you like to check for a specific value?
>
> Can you give an example when this is a good thing to do?
A forum. You have two submit buttons, one labeled 'draft' and one
labeled 'final'.
If the user uses the draft button, the forum displays a preview of the
user's post for them to edit. If they use the 'final' button, then
their post gets put straight into the forum, typos and all.
<form name="myForumPost">
<textarea name="text"></textarea>
<input name="submit" name="submit" value="draft">
<input name="submit" name="submit" value="final">
</form>
<?php
switch ($_POST['submit']) {
case 'draft': // display draft of the post for the user to review.
break;
case 'submit': // save final version of post in forum.
break;
default: // someone's being silly.
}
?>