Re: checkbocks, arrays and more
| From: | Richard Lynch | Date: | Thu, 15 Feb 2001 23:29:53 +0000 |
| Subject: | Re: checkbocks, arrays and more | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-40019@lists.php.net to get a copy of this message | ||
> coke machine
> vending machine
> atm
> dinner
> public phone
You probably have an "asset_id" field on each of those.
> and someone is inserting a gas station there... and it has two dinners and
> 3 public phones, so he would check the checkboxes referring to these and
> add a little comment to show the number... right?
>
> but how can I pass this to the next page so I can insert in the tables?
> if I only had the checkboxes, it'd be easy like:
>
> <input type=checkbox name="assets[]"> <== for each of them... but how can
I
> add the input type text next to each of the checkboxes and make them
> referrable?
Despite the "Note:" in FAQ 8.1 (grrr!), you *can* use indices in your FORM
NAME attributes if it makes sense to do so.
<?php
$asset_names[13] = 'Public Restrooms';
echo "<input type=checkbox name=assets[13]> $asset_names[13] <input
name=quantity[13] size=2><BR>\n";
?>
Your processing script will then have:
$assets[13] and $quantity[13], both referring to Public Restrooms.
--
Visit the Zend Store at http://www.zend.com/store/
Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm