Re: checkbox question
| From: | Craig Donnelly | Date: | Mon, 09 Sep 2002 12:21:52 +0000 |
| Subject: | Re: checkbox question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-115728@lists.php.net to get a copy of this message | ||
Why cant you use square brackets??
call all your checkboxes the following:
interesting_area[]
Then post it to whatever page, now all the checkboxes that were checked are
held in a array (interesting_area)
To see what is contained in the array, do the following:
<?php
echo "<pre>";
print_r($_POST[interesting_area]);
echo "</pre>";
?>
From here it depends on what you want to do with the data..
You can loop through the array, using for(), foreach() or while(), or
alternatively write a function to manipulate the data.
Hope that helps,
Craig
"Alex Shi" <chpshi@eol.ca> wrote in message
news:20020909001408.28821.qmail@pb1.pair.com...
> How to ontain data from a group of checkbox using same name?
> For example, in a form there're 6 checkboxes and all named as
> "Interesting_Area". I know if put a pairs of square brackets at the
> end of the name then in php all the values of them can be ontained.
> However, for some reason I cannot use square brackets. Please
> help me out if anyone know how to do the trick. THanks!
>
> Alex
>
>
> --
> ---------------------------
> TrafficBuilder Network:
> http://www.bestadv.net/index.cfm?ref=7029
>