On Thu, March 8, 2007 11:56 am, Otto Wyss wrote:
> From an arry I create a table like
>
> foreach ($persons as $key => $pers) {
> echo "<td><input name=\"K$key\" type=\"checkbox\" ...></td>
> <td>...</td>
> }
>
> so each checkbox field has its own name created from $key. Yet how can
> I
> access these fields (names) later on?
>
> foreach ($persons as $key => $pers) {
> if ($K???) {
> $cnt += 1; ...
> }
> }
This is where you use variable variables when you don't know that you
shouldn't have done that...
> Is there a better way to access multiple fields from a table?
Use arrays.
<input name="K[<?php echo $key?>]" value="<?php echo $K[$key]?>" />
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php