Re: Problems by transfer of arrayed formfield
| From: | antispo | Date: | Sun, 12 Feb 2006 21:40:07 +0000 |
| Subject: | Re: Problems by transfer of arrayed formfield | ||
| References: | 1 2 3 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-41235@lists.php.net to get a copy of this message | ||
r1.php
> <form action="r2.php" method="POST">
>
> <?php
>
> for($i=1; $i<=5; $i++) {
> echo "<input type=checkbox name=\"ids[]\" value=". $i
> .">";
> }
>
>
> ?>
>
> <input type="submit" value="OK" />
>
> </form>
>
r2.php
<?php
$ids = $_POST['ids'];
foreach ($ids as $i) {
$new_ids[] = $i;
}
print_r($new_ids);
?>
..iterate trough the submited array with foreach instead of for...