Re: Re: Variable name as a string
| From: | Ross McKay | Date: | Thu, 28 Aug 2008 04:13:39 +0000 |
| Subject: | Re: Re: Variable name as a string | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-278854@lists.php.net to get a copy of this message | ||
More specifically:
<form action="<?php echo $_SERVER['SCRIPT_NAME']; ?>"
method="post">
<p>option 1 - colour:<br/>
# <input type="checkbox" name="options[colour][]" value="red"/>
red<br/>
# <input type="checkbox" name="options[colour][]"
value="green"/>
green<br/>
# <input type="checkbox" name="options[colour][]" value="blue"/>
blue</p>
<p><input type="submit"/></p>
</form>
<?php
foreach($_POST['options']['colour'] as $colour)
echo "<p>colour: $colour</p>\n";
?>
--
Ross McKay, Toronto, NSW Australia
"If ye cannae see the bottom, dinnae complain if ye droon"
- The Wee Book of Calvin