note 115996 deleted from control-structures.switch by peehaa

From: Date: Sun, 26 Oct 2014 00:47:49 +0000
Subject: note 115996 deleted from control-structures.switch by peehaa
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-200729@lists.php.net to get a copy of this message
Note Submitter: edprim1 at gmail dot com ---- I have the following code: <option value="">Choose a Selection...</option> <option value=http://www.site.com/page.php?namez="1">case 1</option> <option value=http://www.site.com/page.php?namez="2">case 2</option> <option value=http://www.site.com/page.php?namez="3">case 3</option> </select> ----------- by selecting any of the above, you are able to use this info in a switch statement to perform different functions. For example, <?php switch ($namez) { case "apple": echo "i is apple"; break; case "bar": echo "i is bar"; break; case "cake": echo "i is cake"; break; } ?> The challenge with this approach is that PHP does not seem to like this combination. It seems to have an issue with $namez in the switch statement. Can someone help me to understand why not? What is the fix for this issue?

« previous php.notes (#200729) next »