Re: using foreach() to capture multiple selections
| From: | Matthew Sims | Date: | Tue, 21 Sep 2004 19:53:26 +0000 |
| Subject: | Re: using foreach() to capture multiple selections | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-197472@lists.php.net to get a copy of this message | ||
>
> i would like to to put multiple selections from a form list into a single
> variable using foreach but am unsure how to do so.
>
> can someone advise how to adapt the following code?
>
> <?php
>
> print "You are interested in: ";
>
> foreach($myGoals as $value)
>
> {
>
> print "$value ";
>
> }
>
> ?>
Not to do all the work for you but do you mean:
You are interested in:
<form method="post" action="phpPage.php">
<?php foreach ($myGoals as $value): ?>
<input type="radio" name="goals" value="<?php echo $value;
?>"><?php
echo $value; ?>
<?php endforeach; ?>
</form>
--
--Matthew Sims
--<http://killermookie.org>