Arrays in forms {?!}

From: Date: Wed, 24 Apr 2002 05:19:32 +0000
Subject: Arrays in forms {?!}
Groups: php.general 
Request: Send a blank email to php-general+get-94307@lists.php.net to get a copy of this message
Hi all, I have a form, with about 40 checkboxes, I want to write a PHP document that processes the submission and displays the values of the checkboxes that were checked. Pretty basic stuff, I've tried a few different things, some work but display "Array" at the top of the list of values. <Snippet of HTML> <td> <input type="checkbox" name="games[]" value="Counter-Strike"> </td> <td>Counter-Strike</td> <td> <input type="checkbox" name="games[]" value="Total Annihilation"> </td> <td>Total Annihilation</td> </tr> </Snippet of HTML> <Snippet of PHP> while ( $element = each( $games ) ) { echo $element["value"]; echo "<br>"; } </Snippet of PHP> I tried this too, it gave the same results as the above... if (is_array($games)) { for ($z=0;$z<count($games);$z++) { echo "$games[$z]<BR>"; } } else { echo "$games"; } I'm missing something real stupid, please help me out Thanks, Liam

« previous php.general (#94307) next »