note 62299 deleted from control-structures.switch by bjori
| From: | bjori@php.net | Date: | Tue, 11 Apr 2006 22:37:53 +0000 |
| Subject: | note 62299 deleted from control-structures.switch by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-107819@lists.php.net to get a copy of this message | ||
Note Submitter: calrich2006 at gmail dot com
----
You can also swap round the variable and the values.
For example:
<?php
switch("Search") {
case $_POST['searchpostcode']:
echo "Searching post code";
break;
case $_POST['searchcity']:
echo "Searching cities";
break;
case $_POST['searchcounty']:
echo "Searching counties";
break;
}
?>
This could be useful to determine which button a user pressed on a HTML form for example.