For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > February 2006 > Re: [PHP-DB] Problems by transfer of arrayed formfield









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PHP-DB] Problems by transfer of arrayed formfield
antispo

2006-02-12, 6:56 pm

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...

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com