note 62299 added to control-structures.switch

From: Date: Fri, 24 Feb 2006 15:59:00 +0000
Subject: note 62299 added to control-structures.switch
Groups: php.notes 
Request: Send a blank email to php-notes+get-104369@lists.php.net to get a copy of this message
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. ---- Server IP: 85.116.0.130 Probable Submitter: 82.33.126.219 ---- Manual Page -- http://www.php.net/manual/en/control-structures.switch.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+62299 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+62299&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+62299&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+62299&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+62299&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+62299&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+62299&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+62299&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+62299&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#104369) next »