Re: $_POST['xxx'] = "blabla" ?

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

 



On Mon, 22 Nov 2004 21:57:23 +0100, Perry Jönsson <public@xxxxxxxxxxxxxx> 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.
}
?>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[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